Move utilities to core/utils folder.

Also move the names to Utils namespace.
This commit is contained in:
Vladimir Golovnev (Glassez)
2015-05-06 14:53:27 +03:00
parent 427688cb34
commit 191cdc2849
67 changed files with 1172 additions and 1135 deletions

View File

@@ -42,7 +42,7 @@
#include "rssfeed.h"
#include "guiiconprovider.h"
#include "autoexpandabledialog.h"
#include "core/fs_utils.h"
#include "core/utils/fs.h"
AutomatedRssDownloader::AutomatedRssDownloader(const QWeakPointer<RssManager>& manager, QWidget *parent) :
QDialog(parent),
@@ -247,7 +247,7 @@ void AutomatedRssDownloader::updateRuleDefinitionBox()
else
ui->lineEFilter->clear();
ui->saveDiffDir_check->setChecked(!rule->savePath().isEmpty());
ui->lineSavePath->setText(fsutils::toNativePath(rule->savePath()));
ui->lineSavePath->setText(Utils::Fs::toNativePath(rule->savePath()));
ui->checkRegex->setChecked(rule->useRegex());
if (rule->label().isEmpty()) {
ui->comboLabel->setCurrentIndex(-1);
@@ -398,7 +398,7 @@ void AutomatedRssDownloader::on_browseSP_clicked()
{
QString save_path = QFileDialog::getExistingDirectory(this, tr("Destination directory"), QDir::homePath());
if (!save_path.isEmpty())
ui->lineSavePath->setText(fsutils::toNativePath(save_path));
ui->lineSavePath->setText(Utils::Fs::toNativePath(save_path));
}
void AutomatedRssDownloader::on_exportBtn_clicked()

View File

@@ -10,14 +10,14 @@
#include <QDateTime>
#include <QScrollBar>
#include "core/fs_utils.h"
#include "core/utils/fs.h"
HtmlBrowser::HtmlBrowser(QWidget* parent)
: QTextBrowser(parent)
{
m_netManager = new QNetworkAccessManager(this);
m_diskCache = new QNetworkDiskCache(this);
m_diskCache->setCacheDirectory(QDir::cleanPath(fsutils::cacheLocation() + "/rss"));
m_diskCache->setCacheDirectory(QDir::cleanPath(Utils::Fs::cacheLocation() + "/rss"));
m_diskCache->setMaximumCacheSize(50 * 1024 * 1024);
qDebug() << "HtmlBrowser cache path:" << m_diskCache->cacheDirectory() << " max size:" << m_diskCache->maximumCacheSize() / 1024 / 1024 << "MB";
m_netManager->setCache(m_diskCache);

View File

@@ -36,7 +36,7 @@
#include "core/preferences.h"
#include "rssfeed.h"
#include "rssarticle.h"
#include "core/fs_utils.h"
#include "core/utils/fs.h"
RssDownloadRule::RssDownloadRule(): m_enabled(false), m_useRegex(false), m_apstate(USE_GLOBAL)
{
@@ -179,7 +179,7 @@ bool RssDownloadRule::operator==(const RssDownloadRule &other) const {
void RssDownloadRule::setSavePath(const QString &save_path)
{
if (!save_path.isEmpty() && QDir(save_path) != QDir(Preferences::instance()->getSavePath()))
m_savePath = fsutils::fromNativePath(save_path);
m_savePath = Utils::Fs::fromNativePath(save_path);
else
m_savePath = QString();
}

View File

@@ -37,11 +37,11 @@
#include "core/qinisettings.h"
#include "rssarticle.h"
#include "rssparser.h"
#include "core/misc.h"
#include "core/utils/misc.h"
#include "rssdownloadrulelist.h"
#include "core/net/downloadmanager.h"
#include "core/net/downloadhandler.h"
#include "core/fs_utils.h"
#include "core/utils/fs.h"
#include "core/logger.h"
bool rssArticleDateRecentThan(const RssArticlePtr& left, const RssArticlePtr& right)
@@ -78,7 +78,7 @@ RssFeed::RssFeed(RssManager* manager, RssFolder* parent, const QString& url):
RssFeed::~RssFeed()
{
if (!m_icon.startsWith(":/") && QFile::exists(m_icon))
fsutils::forceRemove(m_icon);
Utils::Fs::forceRemove(m_icon);
}
void RssFeed::saveItemsToDisk()

View File

@@ -29,7 +29,7 @@
*/
#include "rssparser.h"
#include "core/fs_utils.h"
#include "core/utils/fs.h"
#include <QDebug>
#include <QFile>
@@ -214,7 +214,7 @@ void RssParser::parseRssFile(const QString& feedUrl, const QString& filePath)
{
qDebug() << Q_FUNC_INFO << feedUrl << filePath;
m_mutex.lock();
ParsingJob job = { feedUrl, fsutils::fromNativePath(filePath) };
ParsingJob job = { feedUrl, Utils::Fs::fromNativePath(filePath) };
m_queue.enqueue(job);
// Wake up thread.
if (m_queue.count() == 1) {
@@ -499,11 +499,11 @@ void RssParser::parseFeed(const ParsingJob& job)
// Clean up
fileRss.close();
emit feedParsingFinished(job.feedUrl, QString());
fsutils::forceRemove(job.filePath);
Utils::Fs::forceRemove(job.filePath);
}
void RssParser::reportFailure(const ParsingJob& job, const QString& error)
{
emit feedParsingFinished(job.feedUrl, error);
fsutils::forceRemove(job.filePath);
Utils::Fs::forceRemove(job.filePath);
}