mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 15:37:23 +00:00
changes in Extensions ABI
* rewrite aggregator to normal qt ui * use X-AW prefix for formatters options * fix logging * use nullptr in headers
This commit is contained in:
parent
326c65528d
commit
51c7299ad0
@ -295,7 +295,7 @@ void AWConfigHelper::readFile(QSettings &settings, const QString key,
|
||||
file.close();
|
||||
settings.setValue(key, text);
|
||||
} else {
|
||||
qCWarning(LOG_LIB) << "Could not open" << file.fileName();
|
||||
qCWarning(LOG_AW) << "Could not open" << file.fileName();
|
||||
}
|
||||
}
|
||||
|
||||
@ -316,6 +316,6 @@ void AWConfigHelper::writeFile(QSettings &settings, const QString key,
|
||||
out.flush();
|
||||
file.close();
|
||||
} else {
|
||||
qCWarning(LOG_LIB) << "Could not open" << file.fileName();
|
||||
qCWarning(LOG_AW) << "Could not open" << file.fileName();
|
||||
}
|
||||
}
|
||||
|
@ -119,8 +119,8 @@ void AWFormatterHelper::initFormatters()
|
||||
for (auto file : files) {
|
||||
if (!file.endsWith(QString(".desktop")))
|
||||
continue;
|
||||
qCInfo(LOG_LIB) << "Found file" << file << "in"
|
||||
<< m_directories.at(i);
|
||||
qCInfo(LOG_AW) << "Found file" << file << "in"
|
||||
<< m_directories.at(i);
|
||||
QString filePath
|
||||
= QString("%1/%2").arg(m_directories.at(i)).arg(file);
|
||||
auto metadata = readMetadata(filePath);
|
||||
@ -161,6 +161,10 @@ void AWFormatterHelper::initKeys()
|
||||
for (auto key : keys) {
|
||||
QString name = settings.value(key).toString();
|
||||
qCInfo(LOG_AW) << "Found formatter" << name << "for key" << key;
|
||||
if (!m_formattersClasses.contains(name)) {
|
||||
qCWarning(LOG_AW) << "Invalid formatter" << name << "found in"
|
||||
<< key;
|
||||
}
|
||||
m_formatters[key] = m_formattersClasses[name];
|
||||
}
|
||||
settings.endGroup();
|
||||
@ -175,7 +179,7 @@ void AWFormatterHelper::installDirectories()
|
||||
QStandardPaths::GenericDataLocation));
|
||||
QDir localDirectory;
|
||||
if (localDirectory.mkpath(localDir))
|
||||
qCInfo(LOG_LIB) << "Created directory" << localDir;
|
||||
qCInfo(LOG_AW) << "Created directory" << localDir;
|
||||
|
||||
m_directories = QStandardPaths::locateAll(
|
||||
QStandardPaths::GenericDataLocation,
|
||||
@ -196,7 +200,7 @@ AWFormatterHelper::readMetadata(const QString filePath) const
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
QString name = settings.value(QString("Name"), filePath).toString();
|
||||
QString type
|
||||
= settings.value(QString("Type"), QString("NoFormat")).toString();
|
||||
= settings.value(QString("X-AW-Type"), QString("NoFormat")).toString();
|
||||
FormatterClass formatter = defineFormatterClass(type);
|
||||
settings.endGroup();
|
||||
|
||||
@ -212,9 +216,12 @@ void AWFormatterHelper::doCreateItem()
|
||||
bool ok;
|
||||
QString select = QInputDialog::getItem(
|
||||
this, i18n("Select type"), i18n("Type:"), selection, 0, false, &ok);
|
||||
if (!ok)
|
||||
if (!ok) {
|
||||
qCWarning(LOG_AW) << "No type selected";
|
||||
return;
|
||||
}
|
||||
|
||||
qCInfo(LOG_AW) << "Selected type" << select;
|
||||
FormatterClass formatter = defineFormatterClass(select);
|
||||
switch (formatter) {
|
||||
case FormatterClass::DateTime:
|
||||
|
@ -198,7 +198,7 @@ void AbstractExtItem::readConfiguration()
|
||||
bool AbstractExtItem::tryDelete() const
|
||||
{
|
||||
bool status = QFile::remove(m_fileName);
|
||||
qCInfo(LOG_AW) << "Remove file" << m_fileName << status;
|
||||
qCInfo(LOG_LIB) << "Remove file" << m_fileName << status;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -16,41 +16,35 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "abstractextitemaggregator.h"
|
||||
#include "ui_abstractextitemaggregator.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QHBoxLayout>
|
||||
#include <QInputDialog>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
|
||||
|
||||
AbstractExtItemAggregator::AbstractExtItemAggregator(QWidget *parent,
|
||||
const QString type)
|
||||
: QWidget(parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::AbstractExtItemAggregator)
|
||||
, m_type(type)
|
||||
{
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
dialog = new QDialog(this);
|
||||
widgetDialog = new QListWidget(dialog);
|
||||
dialogButtons = new QDialogButtonBox(
|
||||
QDialogButtonBox::Open | QDialogButtonBox::Close, Qt::Vertical, dialog);
|
||||
ui->setupUi(this);
|
||||
copyButton
|
||||
= dialogButtons->addButton(i18n("Copy"), QDialogButtonBox::ActionRole);
|
||||
createButton = dialogButtons->addButton(i18n("Create"),
|
||||
= ui->buttonBox->addButton(i18n("Copy"), QDialogButtonBox::ActionRole);
|
||||
createButton = ui->buttonBox->addButton(i18n("Create"),
|
||||
QDialogButtonBox::ActionRole);
|
||||
deleteButton = dialogButtons->addButton(i18n("Remove"),
|
||||
deleteButton = ui->buttonBox->addButton(i18n("Remove"),
|
||||
QDialogButtonBox::ActionRole);
|
||||
QHBoxLayout *layout = new QHBoxLayout(dialog);
|
||||
layout->addWidget(widgetDialog);
|
||||
layout->addWidget(dialogButtons);
|
||||
dialog->setLayout(layout);
|
||||
|
||||
connect(dialogButtons, SIGNAL(clicked(QAbstractButton *)), this,
|
||||
connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton *)), this,
|
||||
SLOT(editItemButtonPressed(QAbstractButton *)));
|
||||
connect(dialogButtons, SIGNAL(rejected()), dialog, SLOT(reject()));
|
||||
connect(widgetDialog, SIGNAL(itemActivated(QListWidgetItem *)), this,
|
||||
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
connect(ui->listWidget, SIGNAL(itemActivated(QListWidgetItem *)), this,
|
||||
SLOT(editItemActivated(QListWidgetItem *)));
|
||||
}
|
||||
|
||||
@ -59,7 +53,7 @@ AbstractExtItemAggregator::~AbstractExtItemAggregator()
|
||||
{
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
delete dialog;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
@ -133,7 +127,7 @@ QString AbstractExtItemAggregator::getName()
|
||||
|
||||
AbstractExtItem *AbstractExtItemAggregator::itemFromWidget()
|
||||
{
|
||||
QListWidgetItem *widgetItem = widgetDialog->currentItem();
|
||||
QListWidgetItem *widgetItem = ui->listWidget->currentItem();
|
||||
if (widgetItem == nullptr)
|
||||
return nullptr;
|
||||
|
||||
@ -155,16 +149,16 @@ AbstractExtItem *AbstractExtItemAggregator::itemFromWidget()
|
||||
|
||||
void AbstractExtItemAggregator::repaintList()
|
||||
{
|
||||
widgetDialog->clear();
|
||||
ui->listWidget->clear();
|
||||
for (auto _item : items()) {
|
||||
QString fileName = QFileInfo(_item->fileName()).fileName();
|
||||
QListWidgetItem *item = new QListWidgetItem(fileName, widgetDialog);
|
||||
QListWidgetItem *item = new QListWidgetItem(fileName, ui->listWidget);
|
||||
QStringList tooltip;
|
||||
tooltip.append(i18n("Name: %1", _item->name()));
|
||||
tooltip.append(i18n("Comment: %1", _item->comment()));
|
||||
tooltip.append(i18n("Identity: %1", _item->uniq()));
|
||||
item->setToolTip(tooltip.join(QChar('\n')));
|
||||
widgetDialog->addItem(item);
|
||||
ui->listWidget->addItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,6 +210,6 @@ void AbstractExtItemAggregator::editItemButtonPressed(QAbstractButton *button)
|
||||
return doCreateItem();
|
||||
else if (static_cast<QPushButton *>(button) == deleteButton)
|
||||
return deleteItem();
|
||||
else if (dialogButtons->buttonRole(button) == QDialogButtonBox::AcceptRole)
|
||||
else if (ui->buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole)
|
||||
return editItem();
|
||||
}
|
||||
|
@ -19,18 +19,20 @@
|
||||
#define ABSTRACTEXTITEMAGGREGATOR_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QListWidget>
|
||||
#include <QPushButton>
|
||||
#include <QStandardPaths>
|
||||
#include <QWidget>
|
||||
|
||||
#include "abstractextitem.h"
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
// additional class since QObject macro does not allow class templates
|
||||
class AbstractExtItemAggregator : public QWidget
|
||||
class QAbstractButton;
|
||||
class QListWidgetItem;
|
||||
namespace Ui
|
||||
{
|
||||
class AbstractExtItemAggregator;
|
||||
}
|
||||
|
||||
class AbstractExtItemAggregator : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QVariant configArgs READ configArgs WRITE setConfigArgs)
|
||||
@ -68,13 +70,6 @@ public:
|
||||
AbstractExtItem *itemFromWidget();
|
||||
void repaintList();
|
||||
int uniqNumber() const;
|
||||
// ui
|
||||
QDialog *dialog = nullptr;
|
||||
QListWidget *widgetDialog = nullptr;
|
||||
QDialogButtonBox *dialogButtons = nullptr;
|
||||
QPushButton *copyButton = nullptr;
|
||||
QPushButton *createButton = nullptr;
|
||||
QPushButton *deleteButton = nullptr;
|
||||
// get methods
|
||||
QVariant configArgs() const;
|
||||
virtual QList<AbstractExtItem *> items() const = 0;
|
||||
@ -87,6 +82,12 @@ private slots:
|
||||
void editItemButtonPressed(QAbstractButton *button);
|
||||
|
||||
private:
|
||||
// ui
|
||||
Ui::AbstractExtItemAggregator *ui = nullptr;
|
||||
QPushButton *copyButton = nullptr;
|
||||
QPushButton *createButton = nullptr;
|
||||
QPushButton *deleteButton = nullptr;
|
||||
// properties
|
||||
QVariant m_configArgs;
|
||||
QString m_type;
|
||||
// ui methods
|
||||
|
64
sources/awesomewidgets/abstractextitemaggregator.ui
Normal file
64
sources/awesomewidgets/abstractextitemaggregator.ui
Normal file
@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AbstractExtItemAggregator</class>
|
||||
<widget class="QDialog" name="AbstractExtItemAggregator">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close|QDialogButtonBox::Open</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>AbstractExtItemAggregator</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>AbstractExtItemAggregator</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -26,13 +26,13 @@ AWAbstractFormatter::AWAbstractFormatter(QWidget *parent,
|
||||
const QString filePath)
|
||||
: AbstractExtItem(parent, filePath)
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
}
|
||||
|
||||
|
||||
AWAbstractFormatter::~AWAbstractFormatter()
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
}
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ QString AWAbstractFormatter::type() const
|
||||
|
||||
void AWAbstractFormatter::setType(const QString _type)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Type" << _type;
|
||||
qCDebug(LOG_LIB) << "Type" << _type;
|
||||
|
||||
m_type = _type;
|
||||
}
|
||||
@ -71,7 +71,7 @@ void AWAbstractFormatter::readConfiguration()
|
||||
QSettings settings(fileName(), QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
setType(settings.value(QString("Type"), m_type).toString());
|
||||
setType(settings.value(QString("X-AW-Type"), m_type).toString());
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
@ -81,10 +81,10 @@ void AWAbstractFormatter::writeConfiguration() const
|
||||
AbstractExtItem::writeConfiguration();
|
||||
|
||||
QSettings settings(writtableConfig(), QSettings::IniFormat);
|
||||
qCInfo(LOG_AW) << "Configuration file" << settings.fileName();
|
||||
qCInfo(LOG_LIB) << "Configuration file" << settings.fileName();
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
settings.setValue(QString("Type"), m_type);
|
||||
settings.setValue(QString("X-AW-Type"), m_type);
|
||||
settings.endGroup();
|
||||
|
||||
settings.sync();
|
||||
|
@ -33,7 +33,7 @@ AWDateTimeFormatter::AWDateTimeFormatter(QWidget *parent,
|
||||
: AWAbstractFormatter(parent, filePath)
|
||||
, ui(new Ui::AWDateTimeFormatter)
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
readConfiguration();
|
||||
ui->setupUi(this);
|
||||
@ -45,7 +45,7 @@ AWDateTimeFormatter::AWDateTimeFormatter(const QString format, QWidget *parent)
|
||||
: AWAbstractFormatter(parent)
|
||||
, ui(new Ui::AWDateTimeFormatter)
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
setFormat(format);
|
||||
|
||||
@ -56,7 +56,7 @@ AWDateTimeFormatter::AWDateTimeFormatter(const QString format, QWidget *parent)
|
||||
|
||||
AWDateTimeFormatter::~AWDateTimeFormatter()
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
delete ui;
|
||||
}
|
||||
@ -64,7 +64,7 @@ AWDateTimeFormatter::~AWDateTimeFormatter()
|
||||
|
||||
QString AWDateTimeFormatter::convert(const QVariant &_value) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Convert value" << _value;
|
||||
qCDebug(LOG_LIB) << "Convert value" << _value;
|
||||
|
||||
return _value.toDateTime().toString(m_format);
|
||||
}
|
||||
@ -93,7 +93,7 @@ QString AWDateTimeFormatter::format() const
|
||||
|
||||
void AWDateTimeFormatter::setFormat(const QString _format)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Set format" << _format;
|
||||
qCDebug(LOG_LIB) << "Set format" << _format;
|
||||
|
||||
m_format = _format;
|
||||
}
|
||||
@ -106,7 +106,7 @@ void AWDateTimeFormatter::readConfiguration()
|
||||
QSettings settings(fileName(), QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
setFormat(settings.value(QString("Format"), m_format).toString());
|
||||
setFormat(settings.value(QString("X-AW-Format"), m_format).toString());
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ void AWDateTimeFormatter::writeConfiguration() const
|
||||
qCInfo(LOG_LIB) << "Configuration file" << settings.fileName();
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
settings.setValue(QString("Format"), m_format);
|
||||
settings.setValue(QString("X-AW-Format"), m_format);
|
||||
settings.endGroup();
|
||||
|
||||
settings.sync();
|
||||
|
@ -47,7 +47,7 @@ public slots:
|
||||
void writeConfiguration() const;
|
||||
|
||||
private:
|
||||
Ui::AWDateTimeFormatter *ui;
|
||||
Ui::AWDateTimeFormatter *ui = nullptr;
|
||||
void translate();
|
||||
// properties
|
||||
QString m_format = QString();
|
||||
|
@ -31,7 +31,7 @@ AWFloatFormatter::AWFloatFormatter(QWidget *parent, const QString filePath)
|
||||
: AWAbstractFormatter(parent, filePath)
|
||||
, ui(new Ui::AWFloatFormatter)
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
readConfiguration();
|
||||
ui->setupUi(this);
|
||||
@ -46,7 +46,7 @@ AWFloatFormatter::AWFloatFormatter(const int count, const QChar fillChar,
|
||||
: AWAbstractFormatter(parent)
|
||||
, ui(new Ui::AWFloatFormatter)
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
setCount(count);
|
||||
setFillChar(fillChar);
|
||||
@ -62,7 +62,7 @@ AWFloatFormatter::AWFloatFormatter(const int count, const QChar fillChar,
|
||||
|
||||
AWFloatFormatter::~AWFloatFormatter()
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
delete ui;
|
||||
}
|
||||
@ -70,7 +70,7 @@ AWFloatFormatter::~AWFloatFormatter()
|
||||
|
||||
QString AWFloatFormatter::convert(const QVariant &_value) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Convert value" << _value;
|
||||
qCDebug(LOG_LIB) << "Convert value" << _value;
|
||||
|
||||
return QString("%1").arg(_value.toDouble() * m_multiplier + m_summand,
|
||||
m_count, m_format, m_precision, m_fillChar);
|
||||
@ -135,7 +135,7 @@ double AWFloatFormatter::summand() const
|
||||
|
||||
void AWFloatFormatter::setCount(const int _count)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Set width" << _count;
|
||||
qCDebug(LOG_LIB) << "Set width" << _count;
|
||||
|
||||
m_count = _count;
|
||||
}
|
||||
@ -143,7 +143,7 @@ void AWFloatFormatter::setCount(const int _count)
|
||||
|
||||
void AWFloatFormatter::setFillChar(const QChar _fillChar)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Set char" << _fillChar;
|
||||
qCDebug(LOG_LIB) << "Set char" << _fillChar;
|
||||
|
||||
m_fillChar = _fillChar;
|
||||
}
|
||||
@ -151,11 +151,11 @@ void AWFloatFormatter::setFillChar(const QChar _fillChar)
|
||||
|
||||
void AWFloatFormatter::setFormat(char _format)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Set format" << _format;
|
||||
qCDebug(LOG_LIB) << "Set format" << _format;
|
||||
// http://doc.qt.io/qt-5/qstring.html#argument-formats
|
||||
if ((_format != 'e') && (_format != 'E') && (_format != 'f')
|
||||
&& (_format != 'g') && (_format != 'G')) {
|
||||
qCWarning(LOG_AW) << "Invalid format" << _format;
|
||||
qCWarning(LOG_LIB) << "Invalid format" << _format;
|
||||
_format = 'f';
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ void AWFloatFormatter::setFormat(char _format)
|
||||
|
||||
void AWFloatFormatter::setMultiplier(const double _multiplier)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Set multiplier" << _multiplier;
|
||||
qCDebug(LOG_LIB) << "Set multiplier" << _multiplier;
|
||||
|
||||
m_multiplier = _multiplier;
|
||||
}
|
||||
@ -173,7 +173,7 @@ void AWFloatFormatter::setMultiplier(const double _multiplier)
|
||||
|
||||
void AWFloatFormatter::setPrecision(const int _precision)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Set precision" << _precision;
|
||||
qCDebug(LOG_LIB) << "Set precision" << _precision;
|
||||
|
||||
m_precision = _precision;
|
||||
}
|
||||
@ -181,7 +181,7 @@ void AWFloatFormatter::setPrecision(const int _precision)
|
||||
|
||||
void AWFloatFormatter::setSummand(const double _summand)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Set summand" << _summand;
|
||||
qCDebug(LOG_LIB) << "Set summand" << _summand;
|
||||
|
||||
m_summand = _summand;
|
||||
}
|
||||
@ -194,17 +194,18 @@ void AWFloatFormatter::readConfiguration()
|
||||
QSettings settings(fileName(), QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
setCount(settings.value(QString("Width"), m_count).toInt());
|
||||
setCount(settings.value(QString("X-AW-Width"), m_count).toInt());
|
||||
setFillChar(
|
||||
settings.value(QString("FillChar"), m_fillChar).toString().at(0));
|
||||
setFormat(settings.value(QString("Format"), QString(m_format))
|
||||
settings.value(QString("X-AW-FillChar"), m_fillChar).toString().at(0));
|
||||
setFormat(settings.value(QString("X-AW-Format"), QString(m_format))
|
||||
.toString()
|
||||
.at(0)
|
||||
.toLatin1());
|
||||
setMultiplier(
|
||||
settings.value(QString("Multiplier"), m_multiplier).toDouble());
|
||||
setPrecision(settings.value(QString("Precision"), m_precision).toInt());
|
||||
setSummand(settings.value(QString("Summand"), m_summand).toDouble());
|
||||
settings.value(QString("X-AW-Multiplier"), m_multiplier).toDouble());
|
||||
setPrecision(
|
||||
settings.value(QString("X-AW-Precision"), m_precision).toInt());
|
||||
setSummand(settings.value(QString("X-AW-Summand"), m_summand).toDouble());
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
@ -250,12 +251,12 @@ void AWFloatFormatter::writeConfiguration() const
|
||||
qCInfo(LOG_LIB) << "Configuration file" << settings.fileName();
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
settings.setValue(QString("Width"), m_count);
|
||||
settings.setValue(QString("FillChar"), m_fillChar);
|
||||
settings.setValue(QString("Format"), m_format);
|
||||
settings.setValue(QString("Multiplier"), m_multiplier);
|
||||
settings.setValue(QString("Precision"), m_precision);
|
||||
settings.setValue(QString("Summand"), m_summand);
|
||||
settings.setValue(QString("X-AW-Width"), m_count);
|
||||
settings.setValue(QString("X-AW-FillChar"), m_fillChar);
|
||||
settings.setValue(QString("X-AW-Format"), m_format);
|
||||
settings.setValue(QString("X-AW-Multiplier"), m_multiplier);
|
||||
settings.setValue(QString("X-AW-Precision"), m_precision);
|
||||
settings.setValue(QString("X-AW-Summand"), m_summand);
|
||||
settings.endGroup();
|
||||
|
||||
settings.sync();
|
||||
|
@ -65,7 +65,7 @@ public slots:
|
||||
void writeConfiguration() const;
|
||||
|
||||
private:
|
||||
Ui::AWFloatFormatter *ui;
|
||||
Ui::AWFloatFormatter *ui = nullptr;
|
||||
void translate();
|
||||
// properties
|
||||
int m_count = 0;
|
||||
|
@ -28,7 +28,7 @@ AWNoFormatter::AWNoFormatter(QWidget *parent, const QString filePath)
|
||||
: AWAbstractFormatter(parent, filePath)
|
||||
, ui(new Ui::AWNoFormatter)
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
readConfiguration();
|
||||
ui->setupUi(this);
|
||||
@ -40,7 +40,7 @@ AWNoFormatter::AWNoFormatter(QWidget *parent)
|
||||
: AWAbstractFormatter(parent)
|
||||
, ui(new Ui::AWNoFormatter)
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
ui->setupUi(this);
|
||||
translate();
|
||||
@ -49,7 +49,7 @@ AWNoFormatter::AWNoFormatter(QWidget *parent)
|
||||
|
||||
AWNoFormatter::~AWNoFormatter()
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
delete ui;
|
||||
}
|
||||
@ -57,7 +57,7 @@ AWNoFormatter::~AWNoFormatter()
|
||||
|
||||
QString AWNoFormatter::convert(const QVariant &_value) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Convert value" << _value;
|
||||
qCDebug(LOG_LIB) << "Convert value" << _value;
|
||||
|
||||
return _value.toString();
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public slots:
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
|
||||
private:
|
||||
Ui::AWNoFormatter *ui;
|
||||
Ui::AWNoFormatter *ui = nullptr;
|
||||
void translate();
|
||||
// properties
|
||||
};
|
||||
|
@ -32,7 +32,7 @@ AWScriptFormatter::AWScriptFormatter(QWidget *parent, const QString filePath)
|
||||
: AWAbstractFormatter(parent, filePath)
|
||||
, ui(new Ui::AWScriptFormatter)
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
readConfiguration();
|
||||
ui->setupUi(this);
|
||||
@ -45,7 +45,7 @@ AWScriptFormatter::AWScriptFormatter(const bool appendCode, const QString code,
|
||||
: AWAbstractFormatter(parent)
|
||||
, ui(new Ui::AWScriptFormatter)
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
setAppendCode(appendCode);
|
||||
setCode(code);
|
||||
@ -59,7 +59,7 @@ AWScriptFormatter::AWScriptFormatter(const bool appendCode, const QString code,
|
||||
|
||||
AWScriptFormatter::~AWScriptFormatter()
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
delete ui;
|
||||
}
|
||||
@ -67,7 +67,7 @@ AWScriptFormatter::~AWScriptFormatter()
|
||||
|
||||
QString AWScriptFormatter::convert(const QVariant &_value) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Convert value" << _value;
|
||||
qCDebug(LOG_LIB) << "Convert value" << _value;
|
||||
|
||||
// init engine
|
||||
QJSEngine engine;
|
||||
@ -76,9 +76,9 @@ QString AWScriptFormatter::convert(const QVariant &_value) const
|
||||
QJSValue result = fn.call(args);
|
||||
|
||||
if (result.isError()) {
|
||||
qCWarning(LOG_AW) << "Uncaught exception at line"
|
||||
<< result.property("lineNumber").toInt() << ":"
|
||||
<< result.toString();
|
||||
qCWarning(LOG_LIB) << "Uncaught exception at line"
|
||||
<< result.property("lineNumber").toInt() << ":"
|
||||
<< result.toString();
|
||||
return QString();
|
||||
} else {
|
||||
return result.toString();
|
||||
@ -129,7 +129,7 @@ QString AWScriptFormatter::program() const
|
||||
|
||||
void AWScriptFormatter::setAppendCode(const bool _appendCode)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Set append code" << _appendCode;
|
||||
qCDebug(LOG_LIB) << "Set append code" << _appendCode;
|
||||
|
||||
m_appendCode = _appendCode;
|
||||
}
|
||||
@ -137,7 +137,7 @@ void AWScriptFormatter::setAppendCode(const bool _appendCode)
|
||||
|
||||
void AWScriptFormatter::setCode(const QString _code)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Set code" << _code;
|
||||
qCDebug(LOG_LIB) << "Set code" << _code;
|
||||
|
||||
m_code = _code;
|
||||
}
|
||||
@ -145,7 +145,7 @@ void AWScriptFormatter::setCode(const QString _code)
|
||||
|
||||
void AWScriptFormatter::setHasReturn(const bool _hasReturn)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Set has return" << _hasReturn;
|
||||
qCDebug(LOG_LIB) << "Set has return" << _hasReturn;
|
||||
|
||||
m_hasReturn = _hasReturn;
|
||||
}
|
||||
@ -158,9 +158,11 @@ void AWScriptFormatter::readConfiguration()
|
||||
QSettings settings(fileName(), QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
setAppendCode(settings.value(QString("AppendCode"), m_appendCode).toBool());
|
||||
setCode(settings.value(QString("Code"), m_code).toString());
|
||||
setHasReturn(settings.value(QString("HasReturn"), m_hasReturn).toBool());
|
||||
setAppendCode(
|
||||
settings.value(QString("X-AW-AppendCode"), m_appendCode).toBool());
|
||||
setCode(settings.value(QString("X-AW-Code"), m_code).toString());
|
||||
setHasReturn(
|
||||
settings.value(QString("X-AW-HasReturn"), m_hasReturn).toBool());
|
||||
settings.endGroup();
|
||||
|
||||
initProgram();
|
||||
@ -204,9 +206,9 @@ void AWScriptFormatter::writeConfiguration() const
|
||||
qCInfo(LOG_LIB) << "Configuration file" << settings.fileName();
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
settings.setValue(QString("AppendCode"), m_appendCode);
|
||||
settings.setValue(QString("Code"), m_code);
|
||||
settings.setValue(QString("HasReturn"), m_hasReturn);
|
||||
settings.setValue(QString("X-AW-AppendCode"), m_appendCode);
|
||||
settings.setValue(QString("X-AW-Code"), m_code);
|
||||
settings.setValue(QString("X-AW-HasReturn"), m_hasReturn);
|
||||
settings.endGroup();
|
||||
|
||||
settings.sync();
|
||||
@ -223,7 +225,7 @@ void AWScriptFormatter::initProgram()
|
||||
else
|
||||
m_program = m_code;
|
||||
|
||||
qCInfo(LOG_AW) << "Create JS engine with code" << m_program;
|
||||
qCInfo(LOG_LIB) << "Create JS engine with code" << m_program;
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,7 +56,7 @@ public slots:
|
||||
void writeConfiguration() const;
|
||||
|
||||
private:
|
||||
Ui::AWScriptFormatter *ui;
|
||||
Ui::AWScriptFormatter *ui = nullptr;
|
||||
void initProgram();
|
||||
void translate();
|
||||
// properties
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
void editItems()
|
||||
{
|
||||
repaintList();
|
||||
int ret = dialog->exec();
|
||||
int ret = exec();
|
||||
qCInfo(LOG_LIB) << "Dialog returns" << ret;
|
||||
};
|
||||
|
||||
|
@ -58,10 +58,10 @@ private slots:
|
||||
void quotesReplyReceived(QNetworkReply *reply);
|
||||
|
||||
private:
|
||||
QNetworkAccessManager *m_manager;
|
||||
QNetworkAccessManager *m_manager = nullptr;
|
||||
QUrl m_url;
|
||||
bool isRunning = false;
|
||||
Ui::ExtQuotes *ui;
|
||||
Ui::ExtQuotes *ui = nullptr;
|
||||
void translate();
|
||||
// properties
|
||||
QString m_ticker = QString("EURUSD=X");
|
||||
|
@ -73,7 +73,7 @@ private slots:
|
||||
|
||||
private:
|
||||
QProcess *process = nullptr;
|
||||
Ui::ExtScript *ui;
|
||||
Ui::ExtScript *ui = nullptr;
|
||||
void translate();
|
||||
// properties
|
||||
QString m_executable = QString("/usr/bin/true");
|
||||
|
@ -61,7 +61,7 @@ private slots:
|
||||
|
||||
private:
|
||||
QProcess *process = nullptr;
|
||||
Ui::ExtUpgrade *ui;
|
||||
Ui::ExtUpgrade *ui = nullptr;
|
||||
void translate();
|
||||
// properties
|
||||
QString m_executable = QString("/usr/bin/true");
|
||||
|
@ -70,10 +70,10 @@ private slots:
|
||||
void weatherReplyReceived(QNetworkReply *reply);
|
||||
|
||||
private:
|
||||
QNetworkAccessManager *m_manager;
|
||||
QNetworkAccessManager *m_manager = nullptr;
|
||||
QUrl m_url;
|
||||
bool isRunning = false;
|
||||
Ui::ExtWeather *ui;
|
||||
Ui::ExtWeather *ui = nullptr;
|
||||
void translate();
|
||||
// properties
|
||||
QString m_city = QString("London");
|
||||
|
@ -105,7 +105,7 @@ private:
|
||||
GraphicalItemHelper *m_helper = nullptr;
|
||||
QGraphicsScene *m_scene = nullptr;
|
||||
QGraphicsView *m_view = nullptr;
|
||||
Ui::GraphicalItem *ui;
|
||||
Ui::GraphicalItem *ui = nullptr;
|
||||
void initScene();
|
||||
void translate();
|
||||
// properties
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
private:
|
||||
QStringList getSources();
|
||||
// configuration and values
|
||||
ExtItemAggregator<ExtScript> *extScripts;
|
||||
ExtItemAggregator<ExtScript> *extScripts = nullptr;
|
||||
QStringList m_sources;
|
||||
};
|
||||
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
private:
|
||||
QStringList getSources();
|
||||
// configuration and values
|
||||
ExtItemAggregator<ExtQuotes> *extQuotes;
|
||||
ExtItemAggregator<ExtQuotes> *extQuotes = nullptr;
|
||||
QStringList m_sources;
|
||||
QVariantHash m_values;
|
||||
};
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
private:
|
||||
QStringList getSources();
|
||||
// configuration and values
|
||||
ExtItemAggregator<ExtUpgrade> *extUpgrade;
|
||||
ExtItemAggregator<ExtUpgrade> *extUpgrade = nullptr;
|
||||
QStringList m_sources;
|
||||
};
|
||||
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
private:
|
||||
QStringList getSources();
|
||||
// configuration and values
|
||||
ExtItemAggregator<ExtWeather> *extWeather;
|
||||
ExtItemAggregator<ExtWeather> *extWeather = nullptr;
|
||||
QStringList m_sources;
|
||||
QVariantHash m_values;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user