Commit 1e3b90b8 authored by Michael Pyne's avatar Michael Pyne

Remove Kdelibs4Support.

This required a wide assortment of fixes, including deleting
needless #include <koldfoo.h> headers, some minor additional porting
tasks, and adding in includes that were previously only implicitly
included.
parent 4e13f805
......@@ -20,8 +20,8 @@ include(ECMQtDeclareLoggingCategory)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Gui Svg Network Test Widgets)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS CoreAddons Completion Config GlobalAccel
I18n IconThemes DocTools TextWidgets XmlGui Wallet
WidgetsAddons WindowSystem KDELibs4Support)
I18n IconThemes DocTools KIO JobWidgets Notifications TextWidgets XmlGui Wallet
WidgetsAddons WindowSystem)
find_package(Phonon4Qt5 4.6.60 REQUIRED NO_MODULE)
find_package(Taglib 1.6 REQUIRED)
......@@ -165,8 +165,9 @@ endif()
target_link_libraries(juk ${LIBMATH} Qt5::Gui Qt5::Svg Qt5::Widgets
Qt5::Network KF5::ConfigCore KF5::CoreAddons KF5::Completion KF5::GlobalAccel
KF5::KIOCore KF5::KIOWidgets KF5::KIOFileWidgets KF5::JobWidgets KF5::Notifications
KF5::I18n KF5::IconThemes KF5::TextWidgets KF5::XmlGui KF5::WindowSystem
KF5::WidgetsAddons KF5::Wallet KF5::KDELibs4Support Phonon::phonon4qt5 ${TAGLIB_LIBRARIES})
KF5::WidgetsAddons KF5::Wallet Phonon::phonon4qt5 ${TAGLIB_LIBRARIES})
if(TUNEPIMP_FOUND)
target_link_libraries(juk ${TUNEPIMP_LIBRARIES})
endif(TUNEPIMP_FOUND)
......
......@@ -18,8 +18,7 @@
#include "advancedsearchdialog.h"
#include <kcombobox.h>
#include <klocale.h>
#include <kvbox.h>
#include <KLocalizedString>
#include <KStandardGuiItem>
#include <QDialogButtonBox>
......
......@@ -18,12 +18,10 @@
#include "cache.h"
#include "juk-exception.h"
#include <kstandarddirs.h>
#include <kmessagebox.h>
#include <kconfig.h>
#include <klocale.h>
#include <ktoggleaction.h>
#include <kglobal.h>
#include <KLocalizedString>
#include <QDir>
#include <QBuffer>
......
......@@ -16,15 +16,13 @@
#include "collectionlist.h"
#include <klocale.h>
#include <kmessagebox.h>
#include <kmenu.h>
#include <kconfig.h>
#include <kconfiggroup.h>
#include <KConfigGroup>
#include <KSharedConfig>
#include <kactioncollection.h>
#include <kstandarddirs.h>
#include <ktoolbarpopupaction.h>
#include <kdirwatch.h>
#include <KLocalizedString>
#include <QList>
#include <QDragMoveEvent>
......@@ -32,6 +30,7 @@
#include <QApplication>
#include <QTimer>
#include <QTime>
#include <QMenu>
#include <QClipboard>
#include <QFileInfo>
#include <QHeaderView>
......
......@@ -17,8 +17,8 @@
#include "coverdialog.h"
#include <KLocalizedString>
#include <kiconloader.h>
#include <klocale.h>
#include <QTimer>
#include <QMenu>
......
......@@ -17,8 +17,6 @@
#include "coverinfo.h"
#include <kglobal.h>
#include <QApplication>
#include <QRegExp>
#include <QLabel>
......
......@@ -32,7 +32,6 @@
#include <QStandardPaths>
#include <QUrl>
#include <kdemacros.h>
#include <kio/job.h>
#include "juk.h"
......@@ -275,7 +274,7 @@ void CoverManagerPrivate::loadCovers()
// don't do so again. Possible due to a coding error during 3.5
// development.
if(KDE_ISLIKELY(!tracks.contains(path))) {
if(Q_LIKELY(!tracks.contains(path))) {
++covers[(coverKey) id].refCount; // Another track using this.
tracks.insert(path, id);
}
......
......@@ -17,8 +17,6 @@
#ifndef JUK_COVERMANAGER_H
#define JUK_COVERMANAGER_H
#include <ksharedptr.h>
#include <QObject>
#include <QMimeData>
#include <QString>
......
......@@ -17,8 +17,8 @@
#ifndef DBUS_COLLECTION_PROXY_H
#define DBUS_COLLECTION_PROXY_H
#include <QtCore/QObject>
#include <QtCore/QStringList> // Required for Q_CLASSINFO ?
#include <QObject>
#include <QStringList> // Required for Q_CLASSINFO ?
class PlaylistCollection;
......
......@@ -18,11 +18,11 @@
#include "ui_deletedialogbase.h"
#include <KStandardGuiItem>
#include <klocale.h>
#include <kiconloader.h>
#include <kconfig.h>
#include <kconfiggroup.h>
#include <kglobal.h>
#include <KLocalizedString>
#include <KIconLoader>
#include <KConfig>
#include <KConfigGroup>
#include <KSharedConfig>
#include <QDialogButtonBox>
#include <QStringList>
......
......@@ -24,7 +24,6 @@
#include <QFileDialog>
#include <QStandardPaths>
#include <klocale.h>
#include "juk_debug.h"
////////////////////////////////////////////////////////////////////////////////
......
......@@ -21,7 +21,7 @@
#include <QShowEvent>
#include <QVBoxLayout>
#include <klocale.h>
#include <KLocalizedString>
ExampleOptions::ExampleOptions(QWidget *parent) :
QWidget(parent)
......
......@@ -258,7 +258,7 @@ QStringList FileHandle::properties() // static
QString FileHandle::property(const QString &name) const
{
return FileHandleProperties::property(*this, name.toAscii());
return FileHandleProperties::property(*this, name.toUtf8());
}
const FileHandle &FileHandle::null() // static
......
......@@ -20,16 +20,14 @@
#include <algorithm>
#include <kurlrequester.h>
#include <KUrlRequester>
#include <kiconloader.h>
#include <knuminput.h>
#include <KLocalizedString>
#include <kio/job.h>
#include <kio/netaccess.h>
#include <kdesktopfile.h>
#include <kconfiggroup.h>
#include <kglobal.h>
#include <KSharedConfig>
#include <klineedit.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <QFile>
......@@ -947,7 +945,7 @@ bool FileRenamer::moveFile(const QString &src, const QString &dest)
// Move the file.
KIO::Job *job = KIO::file_move(srcURL, dstURL);
return KIO::NetAccess::synchronousRun(job, 0);
return job->exec();
}
void FileRenamer::setFolderIcon(const QUrl &dstURL, const PlaylistItem *item)
......
......@@ -260,12 +260,12 @@
<customwidget>
<class>KUrlRequester</class>
<extends>QFrame</extends>
<header>kurlrequester.h</header>
<header>KUrlRequester</header>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
<header>KComboBox</header>
</customwidget>
</customwidgets>
<tabstops>
......
......@@ -18,7 +18,7 @@
#include "filerenamerconfigdlg.h"
#include "filerenamer.h"
#include <klocale.h>
#include <KLocalizedString>
FileRenamerConfigDlg::FileRenamerConfigDlg(QWidget *parent)
: QDialog(parent)
......
......@@ -16,8 +16,7 @@
#include "filerenameroptions.h"
#include <klocale.h>
#include <knuminput.h>
#include <KLocalizedString>
#include "juk_debug.h"
......
......@@ -18,7 +18,7 @@
#include <QTimer>
#include <KLocale>
#include <KLocalizedString>
#include "collectionlist.h"
#include "playermanager.h"
......
......@@ -17,18 +17,16 @@
#include "juk.h"
#include <kstatusbar.h>
#include <kmessagebox.h>
#include <kactioncollection.h>
#include <kstandardaction.h>
#include <ktoggleaction.h>
#include <kactionmenu.h>
#include <kconfiggroup.h>
#include <kglobal.h>
#include <KSharedConfig>
#include <kglobalaccel.h>
#include <ktoolbarpopupaction.h>
#include <knotification.h>
#include <kdeversion.h>
#include <QIcon>
#include <QAction>
......@@ -39,6 +37,7 @@
#include <QTime>
#include <QTimer>
#include <QDesktopWidget>
#include <QStatusBar>
#include "slideraction.h"
#include "statuslabel.h"
......
......@@ -18,12 +18,12 @@
#include "keydialog.h"
#include "actioncollection.h"
#include <kconfig.h>
#include <klocale.h>
#include <kshortcutseditor.h>
#include <kglobal.h>
#include <kconfiggroup.h>
#include <KConfig>
#include <KShortcutsEditor>
#include <KConfigGroup>
#include <KSharedConfig>
#include <KGlobalAccel>
#include <KLocalizedString>
#include <QAction>
#include <QKeySequence>
......
......@@ -17,21 +17,21 @@
#include <QDomDocument>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QIcon>
#include <QAction>
#include <QUrlQuery>
#include <KLocalizedString>
#include <KActionCollection>
#include <KToggleAction>
#include <KConfigGroup>
#include <QIcon>
#include <kglobal.h>
#include <KSharedConfig>
#include "lyricswidget.h"
#include "tag.h"
#include "actioncollection.h"
#include "juk_debug.h"
LyricsWidget::LyricsWidget(QWidget* parent): QTextBrowser(parent),
m_networkAccessManager(new QNetworkAccessManager),
m_lyricsCurrent(false)
......@@ -75,12 +75,16 @@ void LyricsWidget::makeLyricsRequest()
setHtml(i18n("<i>Loading...</i>"));
// TODO time for https (as long as it doesn't break this)
QUrl listUrl("http://lyrics.wikia.com/api.php");
listUrl.addQueryItem("action", "lyrics");
listUrl.addQueryItem("func", "getSong");
listUrl.addQueryItem("fmt", "xml");
listUrl.addQueryItem("artist", m_playingFile.tag()->artist());
listUrl.addQueryItem("song", m_playingFile.tag()->title());
QUrlQuery listUrlQuery;
listUrlQuery.addQueryItem("action", "lyrics");
listUrlQuery.addQueryItem("func", "getSong");
listUrlQuery.addQueryItem("fmt", "xml");
listUrlQuery.addQueryItem("artist", m_playingFile.tag()->artist());
listUrlQuery.addQueryItem("song", m_playingFile.tag()->title());
listUrl.setQuery(listUrlQuery);
m_title = m_playingFile.tag()->artist() + " &#8211; " + m_playingFile.tag()->title();
connect(m_networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(receiveListReply(QNetworkReply*)));
m_networkAccessManager->get(QNetworkRequest(listUrl));
......@@ -117,13 +121,16 @@ void LyricsWidget::receiveListReply(QNetworkReply* reply)
QString artist = document.elementsByTagName("artist").at(0).toElement().text();
QString title = document.elementsByTagName("song").at(0).toElement().text();
// TODO time for https (as long as it doesn't break this)
QUrl url("http://lyrics.wikia.com/api.php");
url.addQueryItem("action", "query");
url.addQueryItem("prop", "revisions");
url.addQueryItem("rvprop", "content");
url.addQueryItem("format", "xml");
url.addQueryItem("titles", artist + ':' + title);
QUrlQuery urlQuery;
urlQuery.addQueryItem("action", "query");
urlQuery.addQueryItem("prop", "revisions");
urlQuery.addQueryItem("rvprop", "content");
urlQuery.addQueryItem("format", "xml");
urlQuery.addQueryItem("titles", artist + ':' + title);
url.setQuery(urlQuery);
connect(m_networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(receiveLyricsReply(QNetworkReply*)));
m_networkAccessManager->get(QNetworkRequest(url));
}
......
......@@ -14,18 +14,17 @@
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <kuniqueapplication.h>
#include <kaboutdata.h>
#include <kconfigbase.h>
#include <kconfig.h>
#include <klocale.h>
#include <kglobal.h>
#include <kconfiggroup.h>
#include <knotification.h>
#include <KAboutData>
#include <KConfigBase>
#include <KConfig>
#include <KConfigGroup>
#include <KNotification>
#include <KSharedConfig>
#include <KLocalizedString>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include <QApplication>
#include "juk.h"
......
......@@ -16,15 +16,17 @@
#include "mediafiles.h"
#include <klocale.h>
#include <kurl.h>
#include <kio/netaccess.h>
#include <kmimetype.h>
#include <KLocalizedString>
#include <KIO/StatJob>
#include <KJobWidgets>
#include <QWidget>
#include <QFile>
#include <QUrl>
#include <QFileDialog>
#include <QStandardPaths>
#include <QMimeType>
#include <QMimeDatabase>
#include <taglib.h>
#include <taglib_config.h>
......@@ -143,35 +145,35 @@ QString MediaFiles::savePlaylistDialog(const QString &playlistName, QWidget *par
TagLib::File *MediaFiles::fileFactoryByType(const QString &fileName)
{
KMimeType::Ptr result = KMimeType::findByPath(fileName);
// FIXME mimetype no isvalid
//if(!result->isValid())
// return 0;
QMimeDatabase db;
QMimeType result = db.mimeTypeForFile(fileName);
if(!result.isValid())
return nullptr;
TagLib::File *file(0);
TagLib::File *file(nullptr);
QByteArray encodedFileName(QFile::encodeName(fileName));
if(result->is(mp3Type))
if(result.inherits(QLatin1String(mp3Type)))
file = new TagLib::MPEG::File(encodedFileName.constData());
else if(result->is(flacType))
else if(result.inherits(QLatin1String(flacType)))
file = new TagLib::FLAC::File(encodedFileName.constData());
else if(result->is(vorbisType))
else if(result.inherits(QLatin1String(vorbisType)))
file = new TagLib::Vorbis::File(encodedFileName.constData());
#ifdef TAGLIB_WITH_ASF
else if(result->is(asfType))
else if(result.inherits(QLatin1String(asfType)))
file = new TagLib::ASF::File(encodedFileName.constData());
#endif
#ifdef TAGLIB_WITH_MP4
else if(result->is(mp4Type) || result->is(mp4AudiobookType))
else if(result.inherits(QLatin1String(mp4Type)) || result.inherits(QLatin1String(mp4AudiobookType)))
file = new TagLib::MP4::File(encodedFileName.constData());
#endif
else if(result->is(mpcType))
else if(result.inherits(QLatin1String(mpcType)))
file = new TagLib::MPC::File(encodedFileName.constData());
else if(result->is(oggflacType))
else if(result.inherits(QLatin1String(oggflacType)))
file = new TagLib::Ogg::FLAC::File(encodedFileName.constData());
#if TAGLIB_HAS_OPUSFILE
else if(result->is(oggopusType) ||
(result->is(oggType) && fileName.endsWith(QLatin1String(".opus")))
else if(result.inherits(QLatin1String(oggopusType)) ||
(result.inherits(QLatin1String(oggType)) && fileName.endsWith(QLatin1String(".opus")))
)
{
file = new TagLib::Ogg::Opus::File(encodedFileName.constData());
......@@ -183,76 +185,74 @@ TagLib::File *MediaFiles::fileFactoryByType(const QString &fileName)
bool MediaFiles::isMediaFile(const QString &fileName)
{
KMimeType::Ptr result = KMimeType::findByPath(fileName);
// FIXME mimetype no isvalid
/*if(!result->isValid())
return false;*/
QMimeDatabase db;
QMimeType result = db.mimeTypeForFile(fileName);
if(!result.isValid())
return false;
// Search through our table of media types for a match
for(unsigned i = 0; i < ARRAY_SIZE(mediaTypes); ++i) {
if(result->is(mediaTypes[i]))
for(const auto &mimeType : mimeTypes()) {
if(result.inherits(mimeType))
return true;
}
return false;
}
static bool isFileOfMimeType(const QString &fileName, const QString &mimeType)
{
QMimeDatabase db;
QMimeType result = db.mimeTypeForFile(fileName);
return result.isValid() && result.inherits(mimeType);
}
bool MediaFiles::isPlaylistFile(const QString &fileName)
{
KMimeType::Ptr result = KMimeType::findByPath(fileName);
return result->is(m3uType);
return isFileOfMimeType(fileName, m3uType);
}
bool MediaFiles::isMP3(const QString &fileName)
{
KMimeType::Ptr result = KMimeType::findByPath(fileName);
return result->is(mp3Type);
return isFileOfMimeType(fileName, mp3Type);
}
bool MediaFiles::isOgg(const QString &fileName)
{
KMimeType::Ptr result = KMimeType::findByPath(fileName);
return result->is(oggType);
return isFileOfMimeType(fileName, oggType);
}
bool MediaFiles::isFLAC(const QString &fileName)
{
KMimeType::Ptr result = KMimeType::findByPath(fileName);
return result->is(flacType);
return isFileOfMimeType(fileName, flacType);
}
bool MediaFiles::isMPC(const QString &fileName)
{
KMimeType::Ptr result = KMimeType::findByPath(fileName);
return result->is(mpcType);
return isFileOfMimeType(fileName, mpcType);
}
bool MediaFiles::isVorbis(const QString &fileName)
{
KMimeType::Ptr result = KMimeType::findByPath(fileName);
return result->is(vorbisType);
return isFileOfMimeType(fileName, vorbisType);
}
#ifdef TAGLIB_WITH_ASF
bool MediaFiles::isASF(const QString &fileName)
{
KMimeType::Ptr result = KMimeType::findByPath(fileName);
return result->is(asfType);
return isFileOfMimeType(fileName, asfType);
}
#endif
#ifdef TAGLIB_WITH_MP4
bool MediaFiles::isMP4(const QString &fileName)
{
KMimeType::Ptr result = KMimeType::findByPath(fileName);
return result->is(mp4Type) || result->is(mp4AudiobookType);
return isFileOfMimeType(fileName, mp4Type) || isFileOfMimeType(fileName, mp4AudiobookType);
}
#endif
bool MediaFiles::isOggFLAC(const QString &fileName)
{
KMimeType::Ptr result = KMimeType::findByPath(fileName);
return result->is(oggflacType);
return isFileOfMimeType(fileName, oggflacType);
}
QStringList MediaFiles::mimeTypes()
......@@ -273,12 +273,13 @@ QStringList MediaFiles::convertURLsToLocal(const QList<QUrl> &urlList, QWidget *
QUrl localUrl;
for(const auto &url : urlList) {
localUrl = KIO::NetAccess::mostLocalUrl(url, w);
auto localizerJob = KIO::mostLocalUrl(url);
KJobWidgets::setWindow(localizerJob, w);
if(localUrl.isLocalFile())
if(localizerJob->exec() && (localUrl = localizerJob->mostLocalUrl()).isLocalFile())
result.append(localUrl.path());
else
qCDebug(JUK_LOG) << localUrl << " is not a local file, skipping.";
qCDebug(JUK_LOG) << url << " is not a local file, skipping.";
}
return result;
......
......@@ -30,12 +30,11 @@
#include <QCryptographicHash>
#include <QDBusConnection>
#include <QDBusMessage>
#include <QStandardPaths>
#include <QVariant>
#include <QFile>
#include <QUrl>
#include <KStandardDirs>
static QByteArray idFromPlaylistItem(const PlaylistItem *item)
{
return QByteArray("/org/kde/juk/tid_") +
......@@ -209,7 +208,7 @@ QVariantMap MediaPlayer2Player::Metadata() const
QUrl::fromLocalFile(playingFile.absFilePath()).toEncoded());
if(playingFile.coverInfo()->hasCover()) {
QString fallbackFileName = KStandardDirs::locateLocal("tmp",
QString fallbackFileName = QStandardPaths::locate(QStandardPaths::TempLocation,
QString("juk-cover-%1.png").arg(item->trackId()));
QString path = fallbackFileName;
......
......@@ -18,10 +18,10 @@
#include "nowplaying.h"
#include <kiconloader.h>
#include <klocale.h>
#include <krandom.h>
#include <kglobalsettings.h>
#include <kio/netaccess.h>
#include <KLocalizedString>
#include <KIO/StoredTransferJob>
#include <KJobWidgets>
#include <QImage>
#include <QLayout>
......@@ -39,6 +39,7 @@
#include <QList>
#include <QTextDocument>
#include <QFontMetrics>
#include <QFontDatabase>
#include <QApplication>
#include "playlistcollection.h"
......@@ -75,7 +76,7 @@ NowPlaying::NowPlaying(QWidget *parent, PlaylistCollection *collection) :
// With HiDPI the text might actually be bigger... try to account for
// that.
QFont defaultLargeFont(KGlobalSettings::largeFont(QLatin1String("XXXXXXX")));
const QFont defaultLargeFont(QFontDatabase::systemFont(QFontDatabase::TitleFont));
const QFontMetrics fm(defaultLargeFont, this);
g_imageSize = qMax(g_imageSize, fm.lineSpacing());
......@@ -220,15 +221,15 @@ void CoverItem::dropEvent(QDropEvent *e)
QString fileName;
if(KIO::NetAccess::download(urls.front(), fileName, this)) {
if(image.load(fileName)) {
auto getJob = KIO::storedGet(urls.front());
KJobWidgets::setWindow(getJob, this);
if(getJob->exec()) {
if(image.loadFromData(getJob->data())) {
m_file.coverInfo()->setCover(image);
update(m_file);
}
else
qCCritical(JUK_LOG) << "Unable to load image from " << urls.front();
KIO::NetAccess::removeTempFile(fileName);
}
else
qCCritical(JUK_LOG) << "Unable to download " << urls.front();
......@@ -294,9 +295,9 @@ void TrackItem::slotUpdate()
return;
}
QString title = Qt::escape(m_file.tag()->title());
QString artist = Qt::escape(m_file.tag()->artist());
QString album = Qt::escape(m_file.tag()->album());
QString title = m_file.tag()->title().toHtmlEscaped();
QString artist = m_file.tag()->artist().toHtmlEscaped();
QString album = m_file.tag()->album().toHtmlEscaped();
QString separator = (artist.isNull() || album.isNull()) ? QString::null : QString(" - "); //krazy:exclude=nullstrassign for old broken gcc
// This block-o-nastiness makes the font smaller and smaller until it actually fits.
......
......@@ -19,10 +19,10 @@
#include "playermanager.h"
#include <kmessagebox.h>
#include <klocale.h>
#include <kactioncollection.h>
#include <kselectaction.h>
#include <ktoggleaction.h>
#include <KLocalizedString>
#include <Phonon/AudioOutput>
#include <Phonon/MediaObject>
......
......@@ -18,35 +18,31 @@
#include "playlist.h"
#include "juk-exception.h"
#include <KLocalizedString>
#include <KSharedConfig>
#include <kconfig.h>
#include <kmessagebox.h>
#include <kiconloader.h>
#include <klineedit.h>
#include <klocale.h>
#include <kfiledialog.h>
#include <kglobalsettings.h>
#include <kurl.h>
#include <kio/netaccess.h>
#include <kio/copyjob.h>
#include <kmenu.h>
#include <kactioncollection.h>
#include <kconfiggroup.h>
#include <ktoolbarpopupaction.h>
#include <kactionmenu.h>
#include <ktoggleaction.h>
#include <kselectaction.h>
#include <kglobal.h>
#include <kmimetype.h>
#include <QCursor>
#include <QDir>
#include <QDirIterator>
#include <QToolTip>
#include <QFile>
#include <QFileDialog>
#include <QResizeEvent>
#include <QMouseEvent>
#include <QKeyEvent>
#include <QMimeData>
#include <QMenu>
#include <QTimer>
#include <QClipboard>
#include <QTextStream>
......@@ -119,7 +115,7 @@ public:
*/
void setColumnOrder(const Playlist *l);
void toggleColumnVisible(int column);
void setInlineCompletionMode(KGlobalSettings::Completion mode);
void setInlineCompletionMode(KCompletion::CompletionMode mode);
/**
* Apply the settings.
......@@ -137,7 +133,7 @@ private:
static SharedSettings *m_instance;
QList<int> m_columnOrder;
QVector<bool> m_columnsVisible;
KGlobalSettings::Completion m_inlineCompletion;
K