aboutsummaryrefslogtreecommitdiff
path: root/src/qmmpui
diff options
context:
space:
mode:
Diffstat (limited to 'src/qmmpui')
-rw-r--r--src/qmmpui/commandlinemanager.cpp12
-rw-r--r--src/qmmpui/filedialog.cpp10
-rw-r--r--src/qmmpui/general.cpp10
-rw-r--r--src/qmmpui/playlistparser.cpp12
-rw-r--r--src/qmmpui/uiloader.cpp10
5 files changed, 17 insertions, 37 deletions
diff --git a/src/qmmpui/commandlinemanager.cpp b/src/qmmpui/commandlinemanager.cpp
index e50baaa9b..8074d5b12 100644
--- a/src/qmmpui/commandlinemanager.cpp
+++ b/src/qmmpui/commandlinemanager.cpp
@@ -43,16 +43,12 @@ void CommandLineManager::checkOptions()
m_options = new QList<CommandLineOption *>;
m_files = new QHash<CommandLineOption*, QString>;
- QDir pluginsDir (Qmmp::pluginsPath());
- pluginsDir.cd("CommandLineOptions");
- QStringList filters;
- filters << "*.dll" << "*.so";
- foreach (QString fileName, pluginsDir.entryList(filters, QDir::Files))
+ foreach (QString filePath, Qmmp::findPlugins("CommandLineOptions"))
{
- QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
+ QPluginLoader loader(filePath);
QObject *plugin = loader.instance();
if (loader.isLoaded())
- /*qDebug("CommandLineManager: loaded plugin %s", qPrintable(fileName))*/;
+ /*qDebug("CommandLineManager: loaded plugin %s", qPrintable(QFileInfo(filePath).filePath()));*/;
else
qWarning("CommandLineManager: %s", qPrintable(loader.errorString ()));
@@ -63,7 +59,7 @@ void CommandLineManager::checkOptions()
if (option)
{
m_options->append(option);
- m_files->insert(option, pluginsDir.absoluteFilePath(fileName));
+ m_files->insert(option, filePath);
qApp->installTranslator(option->createTranslator(qApp));
}
}
diff --git a/src/qmmpui/filedialog.cpp b/src/qmmpui/filedialog.cpp
index 5b01db370..60f9c6e97 100644
--- a/src/qmmpui/filedialog.cpp
+++ b/src/qmmpui/filedialog.cpp
@@ -1,5 +1,5 @@
/**************************************************************************
-* Copyright (C) 2008-2016 by Ilya Kotov *
+* Copyright (C) 2008-2018 by Ilya Kotov *
* forkotov02@ya.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -44,13 +44,9 @@ void FileDialog::loadPlugins()
m_cache->append(new QmmpUiPluginCache(new QtFileDialogFactory));
QSettings settings (Qmmp::configFile(), QSettings::IniFormat);
- QDir pluginsDir (Qmmp::pluginsPath());
- pluginsDir.cd("FileDialogs");
- QStringList filters;
- filters << "*.dll" << "*.so";
- foreach (QString fileName, pluginsDir.entryList(filters, QDir::Files))
+ foreach (QString filePath, Qmmp::findPlugins("FileDialogs"))
{
- QmmpUiPluginCache *item = new QmmpUiPluginCache(pluginsDir.absoluteFilePath(fileName), &settings);
+ QmmpUiPluginCache *item = new QmmpUiPluginCache(filePath, &settings);
if(item->hasError())
{
delete item;
diff --git a/src/qmmpui/general.cpp b/src/qmmpui/general.cpp
index d93dcd5c6..c233ef2d4 100644
--- a/src/qmmpui/general.cpp
+++ b/src/qmmpui/general.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2008-2014 by Ilya Kotov *
+ * Copyright (C) 2008-2018 by Ilya Kotov *
* forkotov02@ya.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -37,13 +37,9 @@ void General::loadPlugins()
m_cache = new QList<QmmpUiPluginCache*>;
QSettings settings (Qmmp::configFile(), QSettings::IniFormat);
- QDir pluginsDir (Qmmp::pluginsPath());
- pluginsDir.cd("General");
- QStringList filters;
- filters << "*.dll" << "*.so";
- foreach (QString fileName, pluginsDir.entryList(filters, QDir::Files))
+ foreach (QString filePath, Qmmp::findPlugins("General"))
{
- QmmpUiPluginCache *item = new QmmpUiPluginCache(pluginsDir.absoluteFilePath(fileName), &settings);
+ QmmpUiPluginCache *item = new QmmpUiPluginCache(filePath, &settings);
if(item->hasError())
{
delete item;
diff --git a/src/qmmpui/playlistparser.cpp b/src/qmmpui/playlistparser.cpp
index cb2f144ae..2d8f67f06 100644
--- a/src/qmmpui/playlistparser.cpp
+++ b/src/qmmpui/playlistparser.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2008-2017 by Ilya Kotov *
+ * Copyright (C) 2008-2018 by Ilya Kotov *
* forkotov02@ya.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -163,16 +163,12 @@ void PlayListParser::loadFormats()
return;
m_formats = new QList<PlayListFormat*>();
- QDir pluginsDir (Qmmp::pluginsPath());
- pluginsDir.cd("PlayListFormats");
- QStringList filters;
- filters << "*.dll" << "*.so";
- foreach (QString fileName, pluginsDir.entryList(filters, QDir::Files))
+ foreach (QString filePath, Qmmp::findPlugins("PlayListFormats"))
{
- QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
+ QPluginLoader loader(filePath);
QObject *plugin = loader.instance();
if (loader.isLoaded())
- qDebug("PlayListParser: loaded plugin %s", qPrintable(fileName));
+ qDebug("PlayListParser: loaded plugin %s", qPrintable(QFileInfo(filePath).filePath()));
else
qWarning("PlayListParser: %s", qPrintable(loader.errorString ()));
diff --git a/src/qmmpui/uiloader.cpp b/src/qmmpui/uiloader.cpp
index 99e7a02ff..1c742d587 100644
--- a/src/qmmpui/uiloader.cpp
+++ b/src/qmmpui/uiloader.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2011-2017 by Ilya Kotov *
+ * Copyright (C) 2011-2018 by Ilya Kotov *
* forkotov02@ya.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -32,13 +32,9 @@ void UiLoader::loadPlugins()
m_cache = new QList<QmmpUiPluginCache*>;
QSettings settings (Qmmp::configFile(), QSettings::IniFormat);
- QDir pluginsDir (Qmmp::pluginsPath());
- pluginsDir.cd("Ui");
- QStringList filters;
- filters << "*.dll" << "*.so";
- foreach (QString fileName, pluginsDir.entryList(filters, QDir::Files))
+ foreach (QString filePath, Qmmp::findPlugins("Ui"))
{
- QmmpUiPluginCache *item = new QmmpUiPluginCache(pluginsDir.absoluteFilePath(fileName), &settings);
+ QmmpUiPluginCache *item = new QmmpUiPluginCache(filePath, &settings);
if(item->hasError())
{
delete item;