Commit b61b805d authored by Vincent PINON's avatar Vincent PINON

convert KStandardDirs (beginning, easy parts)

parent bbe535a2
......@@ -28,10 +28,7 @@
#include "capture/v4lcapture.h"
#endif
#include <KStandardDirs>
//#include <KService>
#include <KDebug>
//#include <KOpenWithDialog>
#include <kde_file.h>
#include <KIO/NetAccess>
#include <kdeversion.h>
......@@ -50,6 +47,7 @@
#include "jogshuttle/jogaction.h"
#include "jogshuttle/jogshuttleconfig.h"
#include <linux/input.h>
#include <QStandardPaths>
#endif
......@@ -69,7 +67,7 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap<QString, QString>& map
// Hide avformat-novalidate trick, causes crash (bug #2205 and #2206)
m_configMisc.kcfg_projectloading_avformatnovalidate->setVisible(false);
m_configMisc.kcfg_use_exiftool->setEnabled(!KStandardDirs::findExe("exiftool").isEmpty());
m_configMisc.kcfg_use_exiftool->setEnabled(!QStandardPaths::findExecutable("exiftool").isEmpty());
QWidget *p8 = new QWidget;
m_configProject.setupUi(p8);
......@@ -221,7 +219,7 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap<QString, QString>& map
// --timestamp option without bug
if (KdenliveSettings::dvgrab_path().isEmpty() || !QFile::exists(KdenliveSettings::dvgrab_path())) {
QString dvgrabpath = KStandardDirs::findExe("dvgrab");
QString dvgrabpath = QStandardPaths::findExecutable("dvgrab");
KdenliveSettings::setDvgrab_path(dvgrabpath);
}
......@@ -467,7 +465,7 @@ void KdenliveSettingsDialog::initDevices()
// Fill the list of audio playback / recording devices
m_configSdl.kcfg_audio_device->addItem(i18n("Default"), QString());
m_configCapture.kcfg_v4l_alsadevice->addItem(i18n("Default"), "default");
if (!KStandardDirs::findExe("aplay").isEmpty()) {
if (!QStandardPaths::findExecutable("aplay").isEmpty()) {
m_readProcess.setOutputChannelMode(KProcess::OnlyStdoutChannel);
m_readProcess.setProgram("aplay", QStringList() << "-l");
connect(&m_readProcess, SIGNAL(readyReadStandardOutput()) , this, SLOT(slotReadAudioDevices()));
......@@ -850,7 +848,7 @@ void KdenliveSettingsDialog::loadTranscodeProfiles()
void KdenliveSettingsDialog::saveTranscodeProfiles()
{
KSharedConfigPtr config = KSharedConfig::openConfig("kdenlivetranscodingrc", KConfig::CascadeConfig);
//KSharedConfigPtr config = KGlobal::config();
//KSharedConfigPtr config = KSharedConfig::openConfig();
KConfigGroup transConfig(config, "Transcoding");
// read the entries
transConfig.deleteGroup();
......@@ -974,7 +972,7 @@ void KdenliveSettingsDialog::slotUpdatev4lDevice()
m_configCapture.kcfg_v4l_format->blockSignals(true);
m_configCapture.kcfg_v4l_format->clear();
QString vl4ProfilePath = KStandardDirs::locateLocal("appdata", "profiles/video4linux");
QString vl4ProfilePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/profiles/video4linux";
if (QFile::exists(vl4ProfilePath)) {
m_configCapture.kcfg_v4l_format->addItem(i18n("Current settings"));
}
......@@ -1014,13 +1012,13 @@ void KdenliveSettingsDialog::slotUpdatev4lCaptureProfile()
m_configCapture.p_colorspace->setText(ProfilesDialog::getColorspaceDescription(601));
m_configCapture.p_progressive->setText(i18n("Progressive"));
QString vl4ProfilePath = KStandardDirs::locateLocal("appdata", "profiles/video4linux");
QString vl4ProfilePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/profiles/video4linux";
if (!QFile::exists(vl4ProfilePath)) saveCurrentV4lProfile();
}
void KdenliveSettingsDialog::loadCurrentV4lProfileInfo()
{
QString vl4ProfilePath = KStandardDirs::locateLocal("appdata", "profiles/video4linux");
QString vl4ProfilePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/profiles/video4linux";
MltVideoProfile prof;
if (!QFile::exists(vl4ProfilePath)) {
// No default formats found, build one
......@@ -1059,7 +1057,7 @@ void KdenliveSettingsDialog::saveCurrentV4lProfile()
profile.frame_rate_num = m_configCapture.p_fps->text().section('/', 0, 0).toInt();
profile.frame_rate_den = m_configCapture.p_fps->text().section('/', 1, 1).toInt();
profile.progressive = m_configCapture.p_progressive->text() == i18n("Progressive");
QString vl4ProfilePath = KStandardDirs::locateLocal("appdata", "profiles/video4linux");
QString vl4ProfilePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/profiles/video4linux";
ProfilesDialog::saveProfile(profile, vl4ProfilePath);
}
......@@ -1180,7 +1178,7 @@ void KdenliveSettingsDialog::slotUpdateProxyProfile(int ix)
void KdenliveSettingsDialog::slotEditVideo4LinuxProfile()
{
QString vl4ProfilePath = KStandardDirs::locateLocal("appdata", "profiles/video4linux");
QString vl4ProfilePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/profiles/video4linux";
QPointer<ProfilesDialog> w = new ProfilesDialog(vl4ProfilePath);
if (w->exec() == QDialog::Accepted) {
// save and update profile
......
......@@ -21,7 +21,7 @@
#include "kdenlivesettings.h"
#include <KStandardDirs>
#include <KDebug>
#include <KMessageBox>
#include <KIO/NetAccess>
......@@ -31,6 +31,7 @@
#include <QScriptEngine>
#include <QCloseEvent>
#include <QScriptEngine>
#include <QStandardPaths>
ProfilesDialog::ProfilesDialog(QWidget * parent) :
QDialog(parent),
......@@ -200,11 +201,11 @@ bool ProfilesDialog::slotSaveProfile()
} else {
int i = 0;
QString customName = "profiles/customprofile";
QString profilePath = KStandardDirs::locateLocal("appdata", customName + QString::number(i));
QString profilePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + customName + QString::number(i);
kDebug() << " TYING PROFILE FILE: " << profilePath;
while (KIO::NetAccess::exists(QUrl(profilePath), KIO::NetAccess::SourceSide, this)) {
++i;
profilePath = KStandardDirs::locateLocal("appdata", customName + QString::number(i));
profilePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + customName + QString::number(i);
}
saveProfile(profilePath);
}
......@@ -310,7 +311,7 @@ bool ProfilesDialog::existingProfileDescription(const QString &desc)
}
// List custom profiles
QStringList customProfiles = KGlobal::dirs()->findDirs("appdata", "profiles");
QStringList customProfiles = QStandardPaths::locateAll(QStandardPaths::DataLocation, "profiles");
for (int i = 0; i < customProfiles.size(); ++i) {
profilesFiles = QDir(customProfiles.at(i)).entryList(profilesFilter, QDir::Files);
for (int j = 0; j < profilesFiles.size(); ++j) {
......@@ -346,7 +347,7 @@ QString ProfilesDialog::existingProfile(const MltVideoProfile &profile)
}
// Check custom profiles
QStringList customProfiles = KGlobal::dirs()->findDirs("appdata", "profiles");
QStringList customProfiles = QStandardPaths::locateAll(QStandardPaths::DataLocation, "profiles");
for (int i = 0; i < customProfiles.size(); ++i) {
profilesFiles = QDir(customProfiles.at(i)).entryList(profilesFilter, QDir::Files);
for (int j = 0; j < profilesFiles.size(); ++j) {
......@@ -383,7 +384,7 @@ QMap <QString, QString> ProfilesDialog::getProfilesInfo()
}
// List custom profiles
QStringList customProfiles = KGlobal::dirs()->findDirs("appdata", "profiles");
QStringList customProfiles = QStandardPaths::locateAll(QStandardPaths::DataLocation, "profiles");
for (int i = 0; i < customProfiles.size(); ++i) {
profilesFiles = QDir(customProfiles.at(i)).entryList(profilesFilter, QDir::Files);
for (int j = 0; j < profilesFiles.size(); ++j) {
......@@ -451,7 +452,7 @@ QMap <QString, QString> ProfilesDialog::getProfilesFromProperties(int width, int
}
// List custom profiles
QStringList customProfiles = KGlobal::dirs()->findDirs("appdata", "profiles");
QStringList customProfiles = QStandardPaths::locateAll(QStandardPaths::DataLocation, "profiles");
for (int i = 0; i < customProfiles.size(); ++i) {
QStringList profiles = QDir(customProfiles.at(i)).entryList(profilesFilter, QDir::Files);
for (int j = 0; j < profiles.size(); ++j) {
......@@ -477,11 +478,11 @@ void ProfilesDialog::saveProfile(MltVideoProfile &profile, QString profilePath)
if (profilePath.isEmpty()) {
int i = 0;
QString customName = "profiles/customprofile";
profilePath = KStandardDirs::locateLocal("appdata", customName + QString::number(i));
profilePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + customName + QString::number(i);
kDebug() << " TYING PROFILE FILE: " << profilePath;
while (KIO::NetAccess::exists(QUrl(profilePath), KIO::NetAccess::SourceSide, 0)) {
++i;
profilePath = KStandardDirs::locateLocal("appdata", customName + QString::number(i));
profilePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + customName + QString::number(i);
}
}
QFile file(profilePath);
......
......@@ -24,13 +24,14 @@
#include "timecode.h"
#include "dialogs/profilesdialog.h"
#include <KStandardDirs>
#include <KDebug>
#include <KMessageBox>
#include <KRun>
#include <KIO/NetAccess>
#include <KColorScheme>
#include <KNotification>
#include <KStandardDirs>
#include <QDomDocument>
#include <QTreeWidgetItem>
......@@ -43,6 +44,7 @@
#include <QScriptEngine>
#include <QKeyEvent>
#include <QTimer>
#include <QStandardPaths>
#include "locale.h"
......@@ -299,9 +301,9 @@ RenderWidget::RenderWidget(const QString &projectfolder, bool enableProxy, const
// Find path for Kdenlive renderer
m_renderer = QCoreApplication::applicationDirPath() + QString("/kdenlive_render");
if (!QFile::exists(m_renderer)) {
m_renderer = KStandardDirs::findExe("kdenlive_render");
m_renderer = QStandardPaths::findExecutable("kdenlive_render");
if (m_renderer.isEmpty())
m_renderer = KStandardDirs::locate("exe", "kdenlive_render");
m_renderer = QStandardPaths::findExecutable("kdenlive_render");
if (m_renderer.isEmpty())
m_renderer = "kdenlive_render";
}
......@@ -545,7 +547,7 @@ void RenderWidget::slotSaveProfile()
void RenderWidget::saveProfile(const QDomElement &newprofile)
{
QString exportFile = KStandardDirs::locateLocal("appdata", "export/customprofiles.xml");
QString exportFile = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/export/customprofiles.xml";
QDomDocument doc;
QFile file(exportFile);
doc.setContent(&file, false);
......@@ -710,7 +712,7 @@ void RenderWidget::slotEditProfile()
d->setWindowTitle(i18n("Edit Profile"));
if (d->exec() == QDialog::Accepted) {
slotDeleteProfile(false);
QString exportFile = KStandardDirs::locateLocal("appdata", "export/customprofiles.xml");
QString exportFile = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/export/customprofiles.xml";
QDomDocument doc;
QFile file(exportFile);
doc.setContent(&file, false);
......@@ -818,7 +820,7 @@ void RenderWidget::slotDeleteProfile(bool refresh)
QString currentProfile = m_view.size_list->currentItem()->text();
QString metaGroupId = m_view.destination_list->itemData(m_view.destination_list->currentIndex(), Qt::UserRole).toString();
QString exportFile = KStandardDirs::locateLocal("appdata", "export/customprofiles.xml");
QString exportFile = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/export/customprofiles.xml";
QDomDocument doc;
QFile file(exportFile);
doc.setContent(&file, false);
......@@ -958,7 +960,7 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const
QStringList overlayargs;
if (m_view.tc_overlay->isChecked()) {
QString filterFile = KStandardDirs::locate("appdata", "metadata.properties");
QString filterFile = QStandardPaths::locate(QStandardPaths::DataLocation, "metadata.properties");
overlayargs << "meta.attr.timecode=1" << "meta.attr.timecode.markup=#" + QString(m_view.tc_type->currentIndex() ? "frame" : "timecode");
overlayargs << "-attach" << "data_feed:attr_check" << "-attach";
overlayargs << "data_show:" + filterFile << "_loader=1" << "dynamic=1";
......@@ -1609,11 +1611,11 @@ void RenderWidget::parseProfiles(const QString &meta, const QString &group, cons
m_view.destination_list->addItem(QIcon::fromTheme("drive-harddisk"), i18n("Lossless / HQ"), "lossless");
m_view.destination_list->addItem(QIcon::fromTheme("pda"), i18n("Mobile devices"), "mobile");
QString exportFile = KStandardDirs::locate("appdata", "export/profiles.xml");
QString exportFile = QStandardPaths::locate(QStandardPaths::DataLocation, "export/profiles.xml");
parseFile(exportFile, false);
QString exportFolder = KStandardDirs::locateLocal("appdata", "export/");
QString exportFolder = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/export/";
QDir directory = QDir(exportFolder);
QStringList filter;
filter << "*.xml";
......
......@@ -30,17 +30,19 @@
#include <mlt++/Mlt.h>
#include <framework/mlt_version.h>
#include <KStandardDirs>
#include <KLocalizedString>
#include <KProcess>
#include <kmimetype.h>
#include <KRun>
#include <KMessageWidget>
#include <KStandardDirs>
#include <QLabel>
#include <QFile>
#include <QXmlStreamWriter>
#include <QTimer>
#include <QStandardPaths>
// Recommended MLT version
const int mltVersionMajor = MLT_MIN_MAJOR_VERSION;
......@@ -54,7 +56,7 @@ Wizard::Wizard(bool upgrade, QWidget *parent) :
m_systemCheckIsOk(false)
{
setWindowTitle(i18n("Config Wizard"));
setPixmap(QWizard::WatermarkPixmap, QPixmap(KStandardDirs::locate("appdata", "banner.png")));
setPixmap(QWizard::WatermarkPixmap, QPixmap(QStandardPaths::locate(QStandardPaths::DataLocation, "banner.png")));
QWizardPage *page1 = new QWizardPage;
page1->setTitle(i18n("Welcome"));
......@@ -207,7 +209,7 @@ void Wizard::slotUpdateCaptureParameters()
m_capture.v4l_formats->blockSignals(true);
m_capture.v4l_formats->clear();
QString vl4ProfilePath = KStandardDirs::locateLocal("appdata", "profiles/video4linux");
QString vl4ProfilePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/profiles/video4linux";
if (QFile::exists(vl4ProfilePath)) {
MltVideoProfile profileInfo = ProfilesDialog::getVideoProfile(vl4ProfilePath);
m_capture.v4l_formats->addItem(i18n("Current settings (%1x%2, %3/%4fps)", profileInfo.width, profileInfo.height, profileInfo.frame_rate_num, profileInfo.frame_rate_den), QStringList() << QString("unknown") <<QString::number(profileInfo.width)<<QString::number(profileInfo.height)<<QString::number(profileInfo.frame_rate_num)<<QString::number(profileInfo.frame_rate_den));
......@@ -414,7 +416,7 @@ void Wizard::checkMissingCodecs()
bool replaceLibfaacCodec = false;
if (!acodecsList.contains("aac") && acodecsList.contains("libfaac")) replaceLibfaacCodec = true;
QString exportFolder = KStandardDirs::locateLocal("appdata", "export/");
QString exportFolder = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/export/";
QDir directory = QDir(exportFolder);
QStringList filter;
filter << "*.xml";
......@@ -480,17 +482,17 @@ void Wizard::slotCheckPrograms()
QTreeWidgetItem *item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("FFmpeg & ffplay"));
item->setData(1, Qt::UserRole, i18n("Required for proxy clips, transcoding and screen capture"));
item->setSizeHint(0, itemSize);
QString exepath = KStandardDirs::findExe(QString("ffmpeg%1").arg(FFMPEG_SUFFIX));
QString playpath = KStandardDirs::findExe(QString("ffplay%1").arg(FFMPEG_SUFFIX));
QString exepath = QStandardPaths::findExecutable(QString("ffmpeg%1").arg(FFMPEG_SUFFIX));
QString playpath = QStandardPaths::findExecutable(QString("ffplay%1").arg(FFMPEG_SUFFIX));
item->setIcon(0, m_okIcon);
if (exepath.isEmpty()) {
// Check for libav version
exepath = KStandardDirs::findExe("avconv");
exepath = QStandardPaths::findExecutable("avconv");
if (exepath.isEmpty()) item->setIcon(0, m_badIcon);
}
if (playpath.isEmpty()) {
// Check for libav version
playpath = KStandardDirs::findExe("avplay");
playpath = QStandardPaths::findExecutable("avplay");
if (playpath.isEmpty()) item->setIcon(0, m_badIcon);
}
if (!exepath.isEmpty()) KdenliveSettings::setFfmpegpath(exepath);
......@@ -500,23 +502,23 @@ void Wizard::slotCheckPrograms()
item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("dvgrab"));
item->setData(1, Qt::UserRole, i18n("Required for firewire capture"));
item->setSizeHint(0, itemSize);
if (KStandardDirs::findExe("dvgrab").isEmpty()) item->setIcon(0, m_badIcon);
if (QStandardPaths::findExecutable("dvgrab").isEmpty()) item->setIcon(0, m_badIcon);
else item->setIcon(0, m_okIcon);
#endif
item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("dvdauthor"));
item->setData(1, Qt::UserRole, i18n("Required for creation of DVD"));
item->setSizeHint(0, itemSize);
if (KStandardDirs::findExe("dvdauthor").isEmpty()) item->setIcon(0, m_badIcon);
if (QStandardPaths::findExecutable("dvdauthor").isEmpty()) item->setIcon(0, m_badIcon);
else item->setIcon(0, m_okIcon);
item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("genisoimage or mkisofs"));
item->setData(1, Qt::UserRole, i18n("Required for creation of DVD ISO images"));
item->setSizeHint(0, itemSize);
if (KStandardDirs::findExe("genisoimage").isEmpty()) {
if (QStandardPaths::findExecutable("genisoimage").isEmpty()) {
// no GenIso, check for mkisofs
if (!KStandardDirs::findExe("mkisofs").isEmpty()) {
if (!QStandardPaths::findExecutable("mkisofs").isEmpty()) {
item->setIcon(0, m_okIcon);
} else item->setIcon(0, m_badIcon);
} else item->setIcon(0, m_okIcon);
......@@ -524,8 +526,8 @@ void Wizard::slotCheckPrograms()
item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("xine"));
item->setData(1, Qt::UserRole, i18n("Required to preview your DVD"));
item->setSizeHint(0, itemSize);
if (KStandardDirs::findExe("xine").isEmpty()) {
if (!KStandardDirs::findExe("vlc").isEmpty()) {
if (QStandardPaths::findExecutable("xine").isEmpty()) {
if (!QStandardPaths::findExecutable("vlc").isEmpty()) {
item->setText(1, i18n("vlc"));
item->setIcon(0, m_okIcon);
}
......@@ -536,13 +538,13 @@ void Wizard::slotCheckPrograms()
// set up some default applications
QString program;
if (KdenliveSettings::defaultimageapp().isEmpty()) {
program = KStandardDirs::findExe("gimp");
if (program.isEmpty()) program = KStandardDirs::findExe("krita");
program = QStandardPaths::findExecutable("gimp");
if (program.isEmpty()) program = QStandardPaths::findExecutable("krita");
if (!program.isEmpty()) KdenliveSettings::setDefaultimageapp(program);
}
if (KdenliveSettings::defaultaudioapp().isEmpty()) {
program = KStandardDirs::findExe("audacity");
if (program.isEmpty()) program = KStandardDirs::findExe("traverso");
program = QStandardPaths::findExecutable("audacity");
if (program.isEmpty()) program = QStandardPaths::findExecutable("traverso");
if (!program.isEmpty()) KdenliveSettings::setDefaultaudioapp(program);
}
if (KdenliveSettings::defaultplayerapp().isEmpty()) {
......@@ -574,7 +576,7 @@ void Wizard::installExtraMimes(const QString &baseName, const QStringList &globs
if (!extensions.contains(glob)) extensions << glob;
}
kDebug() << "EXTS: " << extensions;
QString packageFileName = KStandardDirs::locateLocal("xdgdata-mime", "packages/" + mimefile + ".xml");
QString packageFileName = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/mime/") + "packages/" + mimefile + ".xml";
kDebug() << "INSTALLING NEW MIME TO: " << packageFileName;
QFile packageFile(packageFileName);
if (!packageFile.open(QIODevice::WriteOnly)) {
......@@ -611,7 +613,7 @@ void Wizard::installExtraMimes(const QString &baseName, const QStringList &globs
void Wizard::runUpdateMimeDatabase()
{
const QString localPackageDir = KStandardDirs::locateLocal("xdgdata-mime", QString());
const QString localPackageDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/mime/");
//Q_ASSERT(!localPackageDir.isEmpty());
KProcess proc;
proc << "update-mime-database";
......@@ -633,7 +635,7 @@ void Wizard::slotCheckThumbs()
else pixname = "timeline_athumbs.png";
}
m_extra.timeline_preview->setPixmap(QPixmap(KStandardDirs::locate("appdata", pixname)));
m_extra.timeline_preview->setPixmap(QPixmap(QStandardPaths::locate(QStandardPaths::DataLocation, pixname)));
}
void Wizard::slotCheckStandard()
......@@ -769,7 +771,7 @@ void Wizard::slotSaveCaptureFormat()
profile.frame_rate_num = format.at(3).toInt();
profile.frame_rate_den = format.at(4).toInt();
profile.progressive = 1;
QString vl4ProfilePath = KStandardDirs::locateLocal("appdata", "profiles/video4linux");
QString vl4ProfilePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/profiles/video4linux";
ProfilesDialog::saveProfile(profile, vl4ProfilePath);
}
......
......@@ -33,11 +33,11 @@
#include <KApplication>
#include <KUrlRequesterDialog>
#include <KMessageBox>
#include <KStandardDirs>
#include <QTreeWidgetItem>
#include <QFile>
#include <QCryptographicHash>
#include <QStandardPaths>
const int hashRole = Qt::UserRole;
const int sizeRole = Qt::UserRole + 1;
......@@ -538,7 +538,7 @@ QString DocumentChecker::searchLuma(const QDir &dir, const QString &file) const
if (result.exists())
return result.filePath();
// Try in Kdenlive's standard KDE path
QString res = KStandardDirs::locate("appdata", "lumas/" + fname);
QString res = QStandardPaths::locate(QStandardPaths::DataLocation, "lumas/" + fname);
if (!res.isEmpty()) return res;
// Try in user's chosen folder
return searchPathRecursively(dir, fname);
......
......@@ -28,7 +28,6 @@
#include <KMessageBox>
#include <KApplication>
#include <KLocalizedString>
#include <KStandardDirs>
#include <KGlobal>
#include <QFile>
......@@ -40,6 +39,7 @@
#include <mlt++/Mlt.h>
#include <locale>
#include <QStandardPaths>
DocumentValidator::DocumentValidator(const QDomDocument &doc, const QUrl &documentUrl):
......@@ -1081,7 +1081,7 @@ void DocumentValidator::updateEffects()
#else
QMap <QString, QString> scripts;
#endif
QStringList directories = KGlobal::dirs()->findDirs("appdata", "effects/update");
QStringList directories = QStandardPaths::locateAll(QStandardPaths::DataLocation, "effects/update");
foreach (const QString &directoryName, directories) {
QDir directory(directoryName);
QStringList fileList = directory.entryList(QStringList() << "*.js", QDir::Files);
......
......@@ -59,6 +59,7 @@
#include <mlt++/Mlt.h>
#include <KJobWidgets/KJobWidgets>
#include <QStandardPaths>
#include "locale.h"
......@@ -836,7 +837,7 @@ ClipManager *KdenliveDoc::clipManager()
QUrl KdenliveDoc::projectFolder() const
{
//if (m_projectFolder.isEmpty()) return QUrl(KStandardDirs::locateLocal("appdata", "/projects/"));
//if (m_projectFolder.isEmpty()) return QUrl(QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "//projects/");
return m_projectFolder;
}
......@@ -1660,7 +1661,7 @@ void KdenliveDoc::updateProjectFolderPlacesEntry()
* http://websvn.kde.org/trunk/KDE/kdelibs/kfile/kfileplacesmodel.cpp?view=markup
*/
const QString file = KStandardDirs::locateLocal("data", "kfileplaces/bookmarks.xml");
const QString file = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/kfileplaces/bookmarks.xml";
KBookmarkManager *bookmarkManager = KBookmarkManager::managerForFile(file, "kfilePlaces");
if (!bookmarkManager) return;
KBookmarkGroup root = bookmarkManager->root();
......
......@@ -26,7 +26,7 @@
#include "timecode.h"
#include "monitor/monitormanager.h"
#include <KStandardDirs>
#include <KLocalizedString>
#include <KFileDialog>
#include <kmimetype.h>
......@@ -38,6 +38,7 @@
#include <QDomDocument>
#include <QMenu>
#include <QGridLayout>
#include <QStandardPaths>
DvdWizard::DvdWizard(MonitorManager *manager, const QString &url, QWidget *parent) :
......@@ -59,7 +60,7 @@ DvdWizard::DvdWizard(MonitorManager *manager, const QString &url, QWidget *paren
, m_burnMenu(new QMenu(this))
{
setWindowTitle(i18n("DVD Wizard"));
//setPixmap(QWizard::WatermarkPixmap, QPixmap(KStandardDirs::locate("appdata", "banner.png")));
//setPixmap(QWizard::WatermarkPixmap, QPixmap(QStandardPaths::locate(QStandardPaths::DataLocation, "banner.png")));
m_pageVob = new DvdWizardVob(this);
m_pageVob->setTitle(i18n("Select Files For Your DVD"));
addPage(m_pageVob);
......@@ -103,14 +104,14 @@ DvdWizard::DvdWizard(MonitorManager *manager, const QString &url, QWidget *paren
connect(m_status.button_preview, SIGNAL(clicked()), this, SLOT(slotPreview()));
QString programName("k3b");
QString exec = KStandardDirs::findExe(programName);
QString exec = QStandardPaths::findExecutable(programName);
if (!exec.isEmpty()) {
//Add K3b action
QAction *k3b = m_burnMenu->addAction(QIcon::fromTheme(programName), i18n("Burn with %1", programName), this, SLOT(slotBurn()));
k3b->setData(exec);
}
programName = "brasero";
exec = KStandardDirs::findExe(programName);
exec = QStandardPaths::findExecutable(programName);
if (!exec.isEmpty()) {
//Add Brasero action
QAction *brasero = m_burnMenu->addAction(QIcon::fromTheme(programName), i18n("Burn with %1", programName), this, SLOT(slotBurn()));
......@@ -766,7 +767,7 @@ void DvdWizard::slotRenderFinished(int exitCode, QProcess::ExitStatus status)
QListWidgetItem *isoitem = m_status.job_progress->item(4);
m_status.job_progress->setCurrentRow(4);
isoitem->setIcon(QIcon::fromTheme("system-run"));
if (!KStandardDirs::findExe("genisoimage").isEmpty()) m_mkiso->start("genisoimage", args);
if (!QStandardPaths::findExecutable("genisoimage").isEmpty()) m_mkiso->start("genisoimage", args);
else m_mkiso->start("mkisofs", args);
}
......@@ -854,7 +855,7 @@ void DvdWizard::slotPreview()
programNames << "xine" << "vlc";
QString exec;
foreach(const QString &prog, programNames) {
exec = KStandardDirs::findExe(prog);
exec = QStandardPaths::findExecutable(prog);
if (!exec.isEmpty()) {
break;
}
......
......@@ -25,7 +25,7 @@
#include <mlt++/Mlt.h>
#include <KDebug>
#include <KStandardDirs>
#include <KFileDialog>
#include <KGlobal>
#include <KConfigGroup>
......@@ -93,8 +93,8 @@ DvdWizardVob::DvdWizardVob(QWidget *parent) :
m_vobList->setIconSize(QSize(60, 45));
QString errorMessage;
if (KStandardDirs::findExe("dvdauthor").isEmpty()) errorMessage.append(i18n("<strong>Program %1 is required for the DVD wizard.</strong>", i18n("dvdauthor")));
if (KStandardDirs::findExe("mkisofs").isEmpty() && KStandardDirs::findExe("genisoimage").isEmpty()) errorMessage.append(i18n("<strong>Program %1 or %2 is required for the DVD wizard.</strong>", i18n("mkisofs"), i18n("genisoimage")));
if (QStandardPaths::findExecutable("dvdauthor").isEmpty()) errorMessage.append(i18n("<strong>Program %1 is required for the DVD wizard.</strong>", i18n("dvdauthor")));
if (QStandardPaths::findExecutable("mkisofs").isEmpty() && QStandardPaths::findExecutable("genisoimage").isEmpty()) errorMessage.append(i18n("<strong>Program %1 or %2 is required for the DVD wizard.</strong>", i18n("mkisofs"), i18n("genisoimage")));
if (!errorMessage.isEmpty()) {
m_view.button_add->setEnabled(false);
m_view.dvd_profile->setEnabled(false);
......
......@@ -31,7 +31,6 @@
#include <QMenu>
#include <QDir>
EffectsListView::EffectsListView(QWidget *parent) :
QWidget(parent)
{
......
......@@ -23,11 +23,12 @@
#include "mainwindow.h"
#include <KDebug>
#include <KStandardDirs>
#include <QAction>
#include <QMenu>
#include <QMimeData>
#include <QStandardPaths>
static const int EFFECT_VIDEO = 1;
......@@ -83,7 +84,7 @@ void EffectsListWidget::initList(QMenu *effectsMenu, KActionCategory *effectActi
currentFolder = currentItem()->text(0);
}
QString effectCategory = KStandardDirs::locate("config", "kdenliveeffectscategory.rc");
QString effectCategory = QStandardPaths::locate(QStandardPaths::ConfigLocation, "kdenliveeffectscategory.rc");
QDomDocument doc;
QFile file(effectCategory);
doc.setContent(&file, false);
......
......@@ -27,8 +27,10 @@
#include <kglobal.h>
#include <KStandardDirs>
#include <QFile>
#include <QDir>
#include <QStandardPaths>
#include "locale.h"
......@@ -70,7 +72,7 @@ void initEffects::refreshLumas()
QStringList filters;
filters << "*.pgm" << "*.png";
QStringList customLumas = KGlobal::dirs()->findDirs("appdata", "lumas");
QStringList customLumas = QStandardPaths::locateAll(QStandardPaths::DataLocation, "lumas");
foreach(const QString & folder, customLumas) {
QStringList filesnames = QDir(folder).entryList(filters, QDir::Files);
foreach(const QString & fname, filesnames) {
......@@ -172,7 +174,7 @@ void initEffects::parseEffectFiles(const QString &locale)
delete transitions;
// Remove blacklisted transitions from the list.
QFile file(KStandardDirs::locate("appdata", "blacklisted_transitions.txt"));
QFile file(QStandardPaths::locate(QStandardPaths::DataLocation, "blacklisted_transitions.txt"));
if (file.open(QIODevice::ReadOnly)) {
QTextStream in(&file);
while (!in.atEnd()) {
......@@ -189,7 +191,7 @@ void initEffects::parseEffectFiles(const QString &locale)
// Remove blacklisted effects from the filters list.
QStringList mltFiltersList = filtersList;
QFile file2(KStandardDirs::locate("appdata", "blacklisted_effects.txt"));
QFile file2(QStandardPaths::locate(QStandardPaths::DataLocation, "blacklisted_effects.txt"));
if (file2.open(QIODevice::ReadOnly)) {
QTextStream in(&file2);
while (!in.atEnd()) {
......@@ -250,7 +252,7 @@ void initEffects::parseEffectFiles(const QString &locale)
}
// Set the directories to look into for effects.
QStringList direc = KGlobal::dirs()->findDirs("appdata", "effects");
QStringList direc = QStandardPaths::locateAll(QStandardPaths::DataLocation, "effects");
// Iterate through effects directories to parse all XML files.
for (more = direc.begin(); more != direc.end(); ++more) {
QDir directory(*more);
......@@ -553,7 +555,7 @@ void initEffects::fillTransitionsList(Mlt::Repository *repository, EffectsList *
QStringList imagefiles = QStringList() << QString();
QStringList filters;
filters << "*.pgm" << "*.png";
QStringList customLumas = KGlobal::dirs()->findDirs("appdata", "lumas");
QStringList customLumas = QStandardPaths::locateAll(QStandardPaths::DataLocation, "lumas");
foreach(QString folder, customLumas) {
if (!folder.endsWith('/'))