* logging changes

* add configuration export status message
* prepare to release
This commit is contained in:
arcan1s
2015-10-20 00:34:29 +03:00
parent c161004640
commit 75ab84e993
39 changed files with 208 additions and 528 deletions

View File

@ -32,7 +32,7 @@ AbstractExtItem::AbstractExtItem(QWidget *parent, const QString desktopName,
, m_fileName(desktopName)
, m_dirs(directories)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
qCDebug(LOG_LIB) << "Desktop name" << desktopName;
qCDebug(LOG_LIB) << "Directories" << directories;
@ -42,14 +42,12 @@ AbstractExtItem::AbstractExtItem(QWidget *parent, const QString desktopName,
AbstractExtItem::~AbstractExtItem()
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
}
template <class T> T *AbstractExtItem::copy(const QString, const int)
{
qCDebug(LOG_LIB);
// an analog of pure virtual method
return new T();
}
@ -57,71 +55,54 @@ template <class T> T *AbstractExtItem::copy(const QString, const int)
int AbstractExtItem::apiVersion() const
{
qCDebug(LOG_LIB);
return m_apiVersion;
}
QString AbstractExtItem::comment() const
{
qCDebug(LOG_LIB);
return m_comment;
}
QStringList AbstractExtItem::directories() const
{
qCDebug(LOG_LIB);
return m_dirs;
}
QString AbstractExtItem::fileName() const
{
qCDebug(LOG_LIB);
return m_fileName;
}
int AbstractExtItem::interval() const
{
qCDebug(LOG_LIB);
return m_interval;
}
bool AbstractExtItem::isActive() const
{
qCDebug(LOG_LIB);
return m_active;
}
QString AbstractExtItem::name() const
{
qCDebug(LOG_LIB);
return m_name;
}
int AbstractExtItem::number() const
{
qCDebug(LOG_LIB);
return m_number;
}
QString AbstractExtItem::tag(const QString _type) const
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Tag type" << _type;
return QString("%1%2").arg(_type).arg(m_number);
@ -130,7 +111,6 @@ QString AbstractExtItem::tag(const QString _type) const
void AbstractExtItem::setApiVersion(const int _apiVersion)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Version" << _apiVersion;
m_apiVersion = _apiVersion;
@ -139,7 +119,6 @@ void AbstractExtItem::setApiVersion(const int _apiVersion)
void AbstractExtItem::setActive(const bool _state)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "State" << _state;
m_active = _state;
@ -148,7 +127,6 @@ void AbstractExtItem::setActive(const bool _state)
void AbstractExtItem::setComment(const QString _comment)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Comment" << _comment;
m_comment = _comment;
@ -157,7 +135,6 @@ void AbstractExtItem::setComment(const QString _comment)
void AbstractExtItem::setInterval(const int _interval)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Interval" << _interval;
if (_interval <= 0)
return;
@ -168,7 +145,6 @@ void AbstractExtItem::setInterval(const int _interval)
void AbstractExtItem::setName(const QString _name)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Name" << _name;
m_name = _name;
@ -177,7 +153,6 @@ void AbstractExtItem::setName(const QString _name)
void AbstractExtItem::setNumber(int _number)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Number" << _number;
if (_number == -1)
_number = []() {
@ -194,8 +169,6 @@ void AbstractExtItem::setNumber(int _number)
void AbstractExtItem::readConfiguration()
{
qCDebug(LOG_LIB);
for (int i = m_dirs.count() - 1; i >= 0; i--) {
if (!QDir(m_dirs.at(i)).entryList(QDir::Files).contains(m_fileName))
continue;
@ -220,8 +193,6 @@ void AbstractExtItem::readConfiguration()
bool AbstractExtItem::tryDelete() const
{
qCDebug(LOG_LIB);
foreach (QString dir, m_dirs) {
bool status = QFile::remove(QString("%1/%2").arg(dir).arg(m_fileName));
qCInfo(LOG_LIB) << "Remove file"
@ -238,8 +209,6 @@ bool AbstractExtItem::tryDelete() const
void AbstractExtItem::writeConfiguration() const
{
qCDebug(LOG_LIB);
QSettings settings(QString("%1/%2").arg(m_dirs.first()).arg(m_fileName),
QSettings::IniFormat);
qCInfo(LOG_LIB) << "Configuration file" << settings.fileName();

View File

@ -29,7 +29,7 @@
AbstractExtItemAggregator::AbstractExtItemAggregator(QWidget *parent)
: QWidget(parent)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
dialog = new QDialog(this);
widgetDialog = new QListWidget(dialog);
@ -56,7 +56,7 @@ AbstractExtItemAggregator::AbstractExtItemAggregator(QWidget *parent)
AbstractExtItemAggregator::~AbstractExtItemAggregator()
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
delete dialog;
}
@ -64,8 +64,6 @@ AbstractExtItemAggregator::~AbstractExtItemAggregator()
QString AbstractExtItemAggregator::getName()
{
qCDebug(LOG_LIB);
bool ok;
QString name = QInputDialog::getText(this, i18n("Enter file name"),
i18n("File name"), QLineEdit::Normal,
@ -81,15 +79,12 @@ QString AbstractExtItemAggregator::getName()
QVariant AbstractExtItemAggregator::configArgs() const
{
qCDebug(LOG_LIB);
return m_configArgs;
}
void AbstractExtItemAggregator::setConfigArgs(const QVariant _configArgs)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Configuration arguments" << _configArgs;
m_configArgs = _configArgs;
@ -99,7 +94,6 @@ void AbstractExtItemAggregator::setConfigArgs(const QVariant _configArgs)
void AbstractExtItemAggregator::editItemActivated(QListWidgetItem *item)
{
Q_UNUSED(item)
qCDebug(LOG_LIB);
return editItem();
}
@ -107,8 +101,6 @@ void AbstractExtItemAggregator::editItemActivated(QListWidgetItem *item)
void AbstractExtItemAggregator::editItemButtonPressed(QAbstractButton *button)
{
qCDebug(LOG_LIB);
if (static_cast<QPushButton *>(button) == copyButton)
return copyItem();
else if (static_cast<QPushButton *>(button) == createButton)

View File

@ -25,7 +25,7 @@
#include <QWidget>
// additinal class since QObject macro does not allow class templates
// additional class since QObject macro does not allow class templates
class AbstractExtItemAggregator : public QWidget
{
Q_OBJECT

View File

@ -24,9 +24,8 @@
#include <QSettings>
#include <QStandardPaths>
#include "awdebug.h"
#include "abstractextitemaggregator.h"
#include "awdebug.h"
template <class T> class ExtItemAggregator : public AbstractExtItemAggregator
@ -36,33 +35,27 @@ public:
: AbstractExtItemAggregator(parent)
, m_type(type)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Type" << type;
qSetMessagePattern(LOG_FORMAT);
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
foreach (const QString metadata, getBuildData())
qCDebug(LOG_LIB) << metadata;
qCDebug(LOG_LIB) << "Type" << type;
initItems();
};
virtual ~ExtItemAggregator()
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
m_items.clear();
m_activeItems.clear();
};
QList<T *> activeItems()
{
qCDebug(LOG_LIB);
return m_activeItems;
};
QList<T *> activeItems() { return m_activeItems; };
void editItems()
{
qCDebug(LOG_LIB);
repaint();
int ret = dialog->exec();
qCInfo(LOG_LIB) << "Dialog returns" << ret;
@ -70,7 +63,6 @@ public:
T *itemByTag(const QString _tag) const
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Tag" << _tag;
T *found = nullptr;
@ -88,7 +80,6 @@ public:
T *itemByTagNumber(const int _number) const
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Number" << _number;
T *found = nullptr;
@ -106,8 +97,6 @@ public:
T *itemFromWidget() const
{
qCDebug(LOG_LIB);
QListWidgetItem *widgetItem = widgetDialog->currentItem();
if (widgetItem == nullptr)
return nullptr;
@ -126,17 +115,10 @@ public:
return found;
};
QList<T *> items() const
{
qCDebug(LOG_LIB);
return m_items;
};
QList<T *> items() const { return m_items; };
int uniqNumber() const
{
qCDebug(LOG_LIB);
QList<int> tagList;
foreach (T *item, m_items)
tagList.append(item->number());
@ -155,8 +137,6 @@ private:
// init method
QList<T *> getItems()
{
qCDebug(LOG_LIB);
// create directory at $HOME
QString localDir = QString("%1/awesomewidgets/%2")
.arg(QStandardPaths::writableLocation(
@ -193,8 +173,6 @@ private:
void initItems()
{
qCDebug(LOG_LIB);
m_items.clear();
m_activeItems.clear();
@ -208,8 +186,6 @@ private:
void repaint()
{
qCDebug(LOG_LIB);
widgetDialog->clear();
foreach (T *_item, m_items) {
QListWidgetItem *item
@ -226,8 +202,6 @@ private:
// methods
void copyItem()
{
qCDebug(LOG_LIB);
T *source = itemFromWidget();
QString fileName = getName();
int number = uniqNumber();
@ -245,8 +219,6 @@ private:
void createItem()
{
qCDebug(LOG_LIB);
QString fileName = getName();
int number = uniqNumber();
QStringList dirs = QStandardPaths::locateAll(
@ -268,8 +240,6 @@ private:
void deleteItem()
{
qCDebug(LOG_LIB);
T *source = itemFromWidget();
if (source == nullptr) {
qCWarning(LOG_LIB) << "Nothing to delete";
@ -284,8 +254,6 @@ private:
void editItem()
{
qCDebug(LOG_LIB);
T *source = itemFromWidget();
if (source == nullptr) {
qCWarning(LOG_LIB) << "Nothing to edit";

View File

@ -38,7 +38,7 @@ ExtQuotes::ExtQuotes(QWidget *parent, const QString quotesName,
: AbstractExtItem(parent, quotesName, directories)
, ui(new Ui::ExtQuotes)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
readConfiguration();
ui->setupUi(this);
@ -64,7 +64,7 @@ ExtQuotes::ExtQuotes(QWidget *parent, const QString quotesName,
ExtQuotes::~ExtQuotes()
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
disconnect(manager, SIGNAL(finished(QNetworkReply *)), this,
SLOT(quotesReplyReceived(QNetworkReply *)));
@ -76,7 +76,6 @@ ExtQuotes::~ExtQuotes()
ExtQuotes *ExtQuotes::copy(const QString _fileName, const int _number)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "File" << _fileName;
qCDebug(LOG_LIB) << "Number" << _number;
@ -96,23 +95,18 @@ ExtQuotes *ExtQuotes::copy(const QString _fileName, const int _number)
QString ExtQuotes::ticker() const
{
qCDebug(LOG_LIB);
return m_ticker;
}
QString ExtQuotes::uniq() const
{
qCDebug(LOG_LIB);
return m_ticker;
}
void ExtQuotes::setTicker(const QString _ticker)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Ticker" << _ticker;
m_ticker = _ticker;
@ -121,7 +115,6 @@ void ExtQuotes::setTicker(const QString _ticker)
void ExtQuotes::readConfiguration()
{
qCDebug(LOG_LIB);
AbstractExtItem::readConfiguration();
for (int i = directories().count() - 1; i >= 0; i--) {
@ -150,7 +143,6 @@ void ExtQuotes::readConfiguration()
QVariantHash ExtQuotes::run()
{
qCDebug(LOG_LIB);
if ((!isActive()) || (isRunning))
return values;
@ -173,7 +165,6 @@ QVariantHash ExtQuotes::run()
int ExtQuotes::showConfiguration(const QVariant args)
{
Q_UNUSED(args)
qCDebug(LOG_LIB);
ui->lineEdit_name->setText(name());
ui->lineEdit_comment->setText(comment());
@ -201,7 +192,6 @@ int ExtQuotes::showConfiguration(const QVariant args)
void ExtQuotes::writeConfiguration() const
{
qCDebug(LOG_LIB);
AbstractExtItem::writeConfiguration();
QSettings settings(
@ -218,7 +208,6 @@ void ExtQuotes::writeConfiguration() const
void ExtQuotes::quotesReplyReceived(QNetworkReply *reply)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Return code" << reply->error();
qCDebug(LOG_LIB) << "Reply error message" << reply->errorString();
@ -274,8 +263,6 @@ void ExtQuotes::quotesReplyReceived(QNetworkReply *reply)
void ExtQuotes::translate()
{
qCDebug(LOG_LIB);
ui->label_name->setText(i18n("Name"));
ui->label_comment->setText(i18n("Comment"));
ui->label_number->setText(i18n("Tag"));
@ -292,8 +279,6 @@ get quotes for the instrument. Refer to <a href=\"http://finance.yahoo.com/\">\
QString ExtQuotes::url() const
{
qCDebug(LOG_LIB);
QString apiUrl = QString(YAHOO_URL);
apiUrl.replace(QString("$TICKER"), m_ticker);
qCInfo(LOG_LIB) << "API url" << apiUrl;

View File

@ -36,7 +36,7 @@ ExtScript::ExtScript(QWidget *parent, const QString scriptName,
: AbstractExtItem(parent, scriptName, directories)
, ui(new Ui::ExtScript)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
readConfiguration();
readJsonFilters();
@ -45,7 +45,7 @@ ExtScript::ExtScript(QWidget *parent, const QString scriptName,
value[tag(QString("custom"))] = QString("");
process = new QProcess(this);
process = new QProcess(nullptr);
connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), this,
SLOT(updateValue()));
process->waitForFinished(0);
@ -54,17 +54,16 @@ ExtScript::ExtScript(QWidget *parent, const QString scriptName,
ExtScript::~ExtScript()
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
process->kill();
delete process;
process->deleteLater();
delete ui;
}
ExtScript *ExtScript::copy(const QString _fileName, const int _number)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "File" << _fileName;
qCDebug(LOG_LIB) << "Number" << _number;
@ -86,48 +85,36 @@ ExtScript *ExtScript::copy(const QString _fileName, const int _number)
QString ExtScript::executable() const
{
qCDebug(LOG_LIB);
return m_executable;
}
QStringList ExtScript::filters() const
{
qCDebug(LOG_LIB);
return m_filters;
}
QString ExtScript::prefix() const
{
qCDebug(LOG_LIB);
return m_prefix;
}
ExtScript::Redirect ExtScript::redirect() const
{
qCDebug(LOG_LIB);
return m_redirect;
}
QString ExtScript::uniq() const
{
qCDebug(LOG_LIB);
return m_executable;
}
QString ExtScript::strRedirect() const
{
qCDebug(LOG_LIB);
QString value;
switch (m_redirect) {
case stdout2stderr:
@ -151,7 +138,6 @@ QString ExtScript::strRedirect() const
void ExtScript::setExecutable(const QString _executable)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Executable" << _executable;
m_executable = _executable;
@ -160,7 +146,6 @@ void ExtScript::setExecutable(const QString _executable)
void ExtScript::setFilters(const QStringList _filters)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Filters" << _filters;
std::for_each(_filters.cbegin(), _filters.cend(),
@ -170,7 +155,6 @@ void ExtScript::setFilters(const QStringList _filters)
void ExtScript::setPrefix(const QString _prefix)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Prefix" << _prefix;
m_prefix = _prefix;
@ -179,7 +163,6 @@ void ExtScript::setPrefix(const QString _prefix)
void ExtScript::setRedirect(const Redirect _redirect)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Redirect" << _redirect;
m_redirect = _redirect;
@ -188,7 +171,6 @@ void ExtScript::setRedirect(const Redirect _redirect)
void ExtScript::setStrRedirect(const QString _redirect)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Redirect" << _redirect;
if (_redirect == QString("stdout2sdterr"))
@ -204,7 +186,6 @@ void ExtScript::setStrRedirect(const QString _redirect)
QString ExtScript::applyFilters(QString _value) const
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Value" << _value;
foreach (QString filt, m_filters) {
@ -225,7 +206,6 @@ QString ExtScript::applyFilters(QString _value) const
void ExtScript::updateFilter(const QString _filter, const bool _add)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Filter" << _filter;
qCDebug(LOG_LIB) << "Should be added" << _add;
@ -241,7 +221,6 @@ void ExtScript::updateFilter(const QString _filter, const bool _add)
void ExtScript::readConfiguration()
{
qCDebug(LOG_LIB);
AbstractExtItem::readConfiguration();
for (int i = directories().count() - 1; i >= 0; i--) {
@ -277,8 +256,6 @@ void ExtScript::readConfiguration()
void ExtScript::readJsonFilters()
{
qCDebug(LOG_LIB);
QString fileName = QStandardPaths::locate(
QStandardPaths::GenericDataLocation,
QString(
@ -306,7 +283,6 @@ void ExtScript::readJsonFilters()
QVariantHash ExtScript::run()
{
qCDebug(LOG_LIB);
if (!isActive())
return value;
@ -329,7 +305,6 @@ QVariantHash ExtScript::run()
int ExtScript::showConfiguration(const QVariant args)
{
Q_UNUSED(args)
qCDebug(LOG_LIB);
ui->lineEdit_name->setText(name());
ui->lineEdit_comment->setText(comment());
@ -375,7 +350,6 @@ int ExtScript::showConfiguration(const QVariant args)
void ExtScript::writeConfiguration() const
{
qCDebug(LOG_LIB);
AbstractExtItem::writeConfiguration();
QSettings settings(
@ -396,8 +370,6 @@ void ExtScript::writeConfiguration() const
void ExtScript::updateValue()
{
qCDebug(LOG_LIB);
qCInfo(LOG_LIB) << "Cmd returns" << process->exitCode();
QString qdebug = QTextCodec::codecForMib(106)
->toUnicode(process->readAllStandardError())
@ -431,8 +403,6 @@ void ExtScript::updateValue()
void ExtScript::translate()
{
qCDebug(LOG_LIB);
ui->label_name->setText(i18n("Name"));
ui->label_comment->setText(i18n("Comment"));
ui->label_number->setText(i18n("Tag"));

View File

@ -34,7 +34,7 @@ ExtUpgrade::ExtUpgrade(QWidget *parent, const QString upgradeName,
: AbstractExtItem(parent, upgradeName, directories)
, ui(new Ui::ExtUpgrade)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
readConfiguration();
ui->setupUi(this);
@ -42,7 +42,7 @@ ExtUpgrade::ExtUpgrade(QWidget *parent, const QString upgradeName,
value[tag(QString("pkgcount"))] = 0;
process = new QProcess(this);
process = new QProcess(nullptr);
connect(process, SIGNAL(finished(int)), this, SLOT(updateValue()));
process->waitForFinished(0);
}
@ -50,17 +50,16 @@ ExtUpgrade::ExtUpgrade(QWidget *parent, const QString upgradeName,
ExtUpgrade::~ExtUpgrade()
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
process->kill();
delete process;
process->deleteLater();
delete ui;
}
ExtUpgrade *ExtUpgrade::copy(const QString _fileName, const int _number)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "File" << _fileName;
qCDebug(LOG_LIB) << "Number" << _number;
@ -82,39 +81,30 @@ ExtUpgrade *ExtUpgrade::copy(const QString _fileName, const int _number)
QString ExtUpgrade::executable() const
{
qCDebug(LOG_LIB);
return m_executable;
}
QString ExtUpgrade::filter() const
{
qCDebug(LOG_LIB);
return m_filter;
}
int ExtUpgrade::null() const
{
qCDebug(LOG_LIB);
return m_null;
}
QString ExtUpgrade::uniq() const
{
qCDebug(LOG_LIB);
return m_executable;
}
void ExtUpgrade::setExecutable(const QString _executable)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Executable" << _executable;
m_executable = _executable;
@ -123,7 +113,6 @@ void ExtUpgrade::setExecutable(const QString _executable)
void ExtUpgrade::setFilter(const QString _filter)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Filter" << _filter;
m_filter = _filter;
@ -132,7 +121,6 @@ void ExtUpgrade::setFilter(const QString _filter)
void ExtUpgrade::setNull(const int _null)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Null lines" << _null;
if (_null < 0)
return;
@ -143,7 +131,6 @@ void ExtUpgrade::setNull(const int _null)
void ExtUpgrade::readConfiguration()
{
qCDebug(LOG_LIB);
AbstractExtItem::readConfiguration();
for (int i = directories().count() - 1; i >= 0; i--) {
@ -175,7 +162,6 @@ void ExtUpgrade::readConfiguration()
QVariantHash ExtUpgrade::run()
{
qCDebug(LOG_LIB);
if (!isActive())
return value;
@ -195,7 +181,6 @@ QVariantHash ExtUpgrade::run()
int ExtUpgrade::showConfiguration(const QVariant args)
{
Q_UNUSED(args)
qCDebug(LOG_LIB);
ui->lineEdit_name->setText(name());
ui->lineEdit_comment->setText(comment());
@ -227,7 +212,6 @@ int ExtUpgrade::showConfiguration(const QVariant args)
void ExtUpgrade::writeConfiguration() const
{
qCDebug(LOG_LIB);
AbstractExtItem::writeConfiguration();
QSettings settings(
@ -247,8 +231,6 @@ void ExtUpgrade::writeConfiguration() const
void ExtUpgrade::updateValue()
{
qCDebug(LOG_LIB);
qCInfo(LOG_LIB) << "Cmd returns" << process->exitCode();
qCInfo(LOG_LIB) << "Error" << process->readAllStandardError();
@ -268,8 +250,6 @@ void ExtUpgrade::updateValue()
void ExtUpgrade::translate()
{
qCDebug(LOG_LIB);
ui->label_name->setText(i18n("Name"));
ui->label_comment->setText(i18n("Comment"));
ui->label_number->setText(i18n("Tag"));

View File

@ -39,7 +39,7 @@ ExtWeather::ExtWeather(QWidget *parent, const QString weatherName,
: AbstractExtItem(parent, weatherName, directories)
, ui(new Ui::ExtWeather)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
readConfiguration();
readJsonMap();
@ -62,7 +62,7 @@ ExtWeather::ExtWeather(QWidget *parent, const QString weatherName,
ExtWeather::~ExtWeather()
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
disconnect(manager, SIGNAL(finished(QNetworkReply *)), this,
SLOT(weatherReplyReceived(QNetworkReply *)));
@ -74,7 +74,6 @@ ExtWeather::~ExtWeather()
ExtWeather *ExtWeather::copy(const QString _fileName, const int _number)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "File" << _fileName;
qCDebug(LOG_LIB) << "Number" << _number;
@ -97,7 +96,6 @@ ExtWeather *ExtWeather::copy(const QString _fileName, const int _number)
QString ExtWeather::weatherFromInt(const int _id) const
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Weather ID" << _id;
QVariantMap map
@ -108,47 +106,36 @@ QString ExtWeather::weatherFromInt(const int _id) const
QString ExtWeather::city() const
{
qCDebug(LOG_LIB);
return m_city;
}
QString ExtWeather::country() const
{
qCDebug(LOG_LIB);
return m_country;
}
bool ExtWeather::image() const
{
qCDebug(LOG_LIB);
return m_image;
}
int ExtWeather::ts() const
{
qCDebug(LOG_LIB);
return m_ts;
}
QString ExtWeather::uniq() const
{
qCDebug(LOG_LIB);
return QString("%1 (%2) at %3").arg(m_city).arg(m_country).arg(m_ts);
}
void ExtWeather::setCity(const QString _city)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "City" << _city;
m_city = _city;
@ -157,7 +144,6 @@ void ExtWeather::setCity(const QString _city)
void ExtWeather::setCountry(const QString _country)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Country" << _country;
m_country = _country;
@ -166,7 +152,6 @@ void ExtWeather::setCountry(const QString _country)
void ExtWeather::setImage(const bool _image)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Use image" << _image;
m_image = _image;
@ -175,7 +160,6 @@ void ExtWeather::setImage(const bool _image)
void ExtWeather::setTs(const int _ts)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Timestamp" << _ts;
m_ts = _ts;
@ -184,7 +168,6 @@ void ExtWeather::setTs(const int _ts)
void ExtWeather::readConfiguration()
{
qCDebug(LOG_LIB);
AbstractExtItem::readConfiguration();
for (int i = directories().count() - 1; i >= 0; i--) {
@ -220,8 +203,6 @@ void ExtWeather::readConfiguration()
void ExtWeather::readJsonMap()
{
qCDebug(LOG_LIB);
QString fileName = QStandardPaths::locate(
QStandardPaths::GenericDataLocation,
QString("awesomewidgets/weather/awesomewidgets-extweather-ids.json"));
@ -248,7 +229,6 @@ void ExtWeather::readJsonMap()
QVariantHash ExtWeather::run()
{
qCDebug(LOG_LIB);
if ((!isActive()) || (isRunning))
return values;
@ -272,7 +252,6 @@ QVariantHash ExtWeather::run()
int ExtWeather::showConfiguration(const QVariant args)
{
Q_UNUSED(args)
qCDebug(LOG_LIB);
ui->lineEdit_name->setText(name());
ui->lineEdit_comment->setText(comment());
@ -306,7 +285,6 @@ int ExtWeather::showConfiguration(const QVariant args)
void ExtWeather::writeConfiguration() const
{
qCDebug(LOG_LIB);
AbstractExtItem::writeConfiguration();
QSettings settings(
@ -327,7 +305,6 @@ void ExtWeather::writeConfiguration() const
void ExtWeather::weatherReplyReceived(QNetworkReply *reply)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Return code" << reply->error();
qCDebug(LOG_LIB) << "Reply error message" << reply->errorString();
@ -364,7 +341,6 @@ void ExtWeather::weatherReplyReceived(QNetworkReply *reply)
QVariantHash ExtWeather::parseSingleJson(const QVariantMap json) const
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Single json data" << json;
QVariantHash output;
@ -393,8 +369,6 @@ QVariantHash ExtWeather::parseSingleJson(const QVariantMap json) const
void ExtWeather::translate()
{
qCDebug(LOG_LIB);
ui->label_name->setText(i18n("Name"));
ui->label_comment->setText(i18n("Comment"));
ui->label_number->setText(i18n("Tag"));
@ -409,7 +383,6 @@ void ExtWeather::translate()
QString ExtWeather::url(const bool isForecast) const
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Is forecast" << isForecast;
QString apiUrl = isForecast ? QString(OWM_FORECAST_URL) : QString(OWM_URL);

View File

@ -39,7 +39,7 @@ GraphicalItem::GraphicalItem(QWidget *parent, const QString desktopName,
: AbstractExtItem(parent, desktopName, directories)
, ui(new Ui::GraphicalItem)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
readConfiguration();
ui->setupUi(this);
@ -56,7 +56,7 @@ GraphicalItem::GraphicalItem(QWidget *parent, const QString desktopName,
GraphicalItem::~GraphicalItem()
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
delete m_scene;
delete ui;
@ -65,7 +65,6 @@ GraphicalItem::~GraphicalItem()
GraphicalItem *GraphicalItem::copy(const QString _fileName, const int _number)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "File" << _fileName;
qCDebug(LOG_LIB) << "Number" << _number;
@ -91,7 +90,6 @@ GraphicalItem *GraphicalItem::copy(const QString _fileName, const int _number)
QString GraphicalItem::image(const QVariant value)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Value" << value;
if (m_bar == QString("none"))
return QString("");
@ -138,48 +136,36 @@ QString GraphicalItem::image(const QVariant value)
QString GraphicalItem::bar() const
{
qCDebug(LOG_LIB);
return m_bar;
}
QString GraphicalItem::activeColor() const
{
qCDebug(LOG_LIB);
return m_activeColor;
}
QString GraphicalItem::inactiveColor() const
{
qCDebug(LOG_LIB);
return m_inactiveColor;
}
QString GraphicalItem::tag() const
{
qCDebug(LOG_LIB);
return QString("bar%1%2").arg(number()).arg(m_bar);
}
GraphicalItem::Type GraphicalItem::type() const
{
qCDebug(LOG_LIB);
return m_type;
}
QString GraphicalItem::strType() const
{
qCDebug(LOG_LIB);
QString value;
switch (m_type) {
case Vertical:
@ -203,16 +189,12 @@ QString GraphicalItem::strType() const
GraphicalItem::Direction GraphicalItem::direction() const
{
qCDebug(LOG_LIB);
return m_direction;
}
QString GraphicalItem::strDirection() const
{
qCDebug(LOG_LIB);
QString value;
switch (m_direction) {
case RightToLeft:
@ -230,31 +212,24 @@ QString GraphicalItem::strDirection() const
int GraphicalItem::height() const
{
qCDebug(LOG_LIB);
return m_height;
}
int GraphicalItem::width() const
{
qCDebug(LOG_LIB);
return m_width;
}
QString GraphicalItem::uniq() const
{
qCDebug(LOG_LIB);
return m_bar;
}
void GraphicalItem::setBar(const QString _bar)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Bar" << _bar;
if (!_bar.contains(QRegExp(
@ -269,7 +244,6 @@ void GraphicalItem::setBar(const QString _bar)
void GraphicalItem::setActiveColor(const QString _color)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Color" << _color;
m_activeColor = _color;
@ -278,7 +252,6 @@ void GraphicalItem::setActiveColor(const QString _color)
void GraphicalItem::setInactiveColor(const QString _color)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Color" << _color;
m_inactiveColor = _color;
@ -287,7 +260,6 @@ void GraphicalItem::setInactiveColor(const QString _color)
void GraphicalItem::setType(const Type _type)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Type" << _type;
m_type = _type;
@ -296,7 +268,6 @@ void GraphicalItem::setType(const Type _type)
void GraphicalItem::setStrType(const QString _type)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Type" << _type;
if (_type == QString("Vertical"))
@ -312,7 +283,6 @@ void GraphicalItem::setStrType(const QString _type)
void GraphicalItem::setDirection(const Direction _direction)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Direction" << _direction;
m_direction = _direction;
@ -321,7 +291,6 @@ void GraphicalItem::setDirection(const Direction _direction)
void GraphicalItem::setStrDirection(const QString _direction)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Direction" << _direction;
if (_direction == QString("RightToLeft"))
@ -333,7 +302,6 @@ void GraphicalItem::setStrDirection(const QString _direction)
void GraphicalItem::setHeight(const int _height)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Height" << _height;
if (_height <= 0)
return;
@ -344,7 +312,6 @@ void GraphicalItem::setHeight(const int _height)
void GraphicalItem::setWidth(const int _width)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Width" << _width;
if (_width <= 0)
return;
@ -355,7 +322,6 @@ void GraphicalItem::setWidth(const int _width)
void GraphicalItem::readConfiguration()
{
qCDebug(LOG_LIB);
AbstractExtItem::readConfiguration();
for (int i = directories().count() - 1; i >= 0; i--) {
@ -399,8 +365,6 @@ void GraphicalItem::readConfiguration()
QVariantHash GraphicalItem::run()
{
qCDebug(LOG_LIB);
// required by abstract class
return QVariantHash();
}
@ -408,7 +372,6 @@ QVariantHash GraphicalItem::run()
int GraphicalItem::showConfiguration(const QVariant args)
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Combobox arguments" << args;
QStringList tags = args.toStringList();
@ -445,7 +408,6 @@ int GraphicalItem::showConfiguration(const QVariant args)
void GraphicalItem::writeConfiguration() const
{
qCDebug(LOG_LIB);
AbstractExtItem::writeConfiguration();
QSettings settings(
@ -469,8 +431,6 @@ void GraphicalItem::writeConfiguration() const
void GraphicalItem::changeColor()
{
qCDebug(LOG_LIB);
QColor color
= stringToColor((static_cast<QPushButton *>(sender()))->text());
QColor newColor = QColorDialog::getColor(color, this, tr("Select color"),
@ -492,8 +452,6 @@ void GraphicalItem::changeColor()
void GraphicalItem::initScene()
{
qCDebug(LOG_LIB);
// init scene
m_scene = new QGraphicsScene();
if (m_type == Graph)
@ -513,8 +471,6 @@ void GraphicalItem::initScene()
void GraphicalItem::paintCircle(const float value)
{
qCDebug(LOG_LIB);
QPen pen;
pen.setWidth(1.0);
float percent = value / 100.0;
@ -540,8 +496,6 @@ void GraphicalItem::paintCircle(const float value)
void GraphicalItem::paintGraph(const QList<float> value)
{
qCDebug(LOG_LIB);
QPen pen;
pen.setColor(stringToColor(m_activeColor));
@ -563,8 +517,6 @@ void GraphicalItem::paintGraph(const QList<float> value)
void GraphicalItem::paintHorizontal(const float value)
{
qCDebug(LOG_LIB);
QPen pen;
float percent = value / 100.0;
@ -582,8 +534,6 @@ void GraphicalItem::paintHorizontal(const float value)
void GraphicalItem::paintVertical(const float value)
{
qCDebug(LOG_LIB);
QPen pen;
float percent = value / 100.0;
@ -601,7 +551,6 @@ void GraphicalItem::paintVertical(const float value)
QColor GraphicalItem::stringToColor(const QString _color) const
{
qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Color" << _color;
QColor qcolor;
@ -619,8 +568,6 @@ QColor GraphicalItem::stringToColor(const QString _color) const
void GraphicalItem::translate()
{
qCDebug(LOG_LIB);
ui->label_name->setText(i18n("Name"));
ui->label_comment->setText(i18n("Comment"));
ui->label_value->setText(i18n("Value"));