more correct methods naming, prepare to move to templates

This commit is contained in:
arcan1s
2015-07-25 00:03:45 +03:00
parent 4742617e3e
commit 3b6df44489
17 changed files with 144 additions and 161 deletions

View File

@ -67,7 +67,7 @@ void AWActions::checkUpdates()
}
bool AWActions::dropCache()
bool AWActions::dropCache() const
{
if (debug) qDebug() << PDEBUG;
@ -78,7 +78,7 @@ bool AWActions::dropCache()
}
bool AWActions::isDebugEnabled()
bool AWActions::isDebugEnabled() const
{
if (debug) qDebug() << PDEBUG;
@ -86,7 +86,7 @@ bool AWActions::isDebugEnabled()
}
void AWActions::runCmd(const QString cmd)
void AWActions::runCmd(const QString cmd) const
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd;
@ -98,13 +98,13 @@ void AWActions::runCmd(const QString cmd)
}
void AWActions::sendEmail()
void AWActions::sendEmail() const
{
if (debug) qDebug() << PDEBUG;
}
void AWActions::showReadme()
void AWActions::showReadme() const
{
if (debug) qDebug() << PDEBUG;
@ -112,7 +112,7 @@ void AWActions::showReadme()
}
QString AWActions::getAboutText(const QString type)
QString AWActions::getAboutText(const QString type) const
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Type" << type;
@ -151,7 +151,7 @@ QString AWActions::getAboutText(const QString type)
}
QVariantMap AWActions::getFont(const QVariantMap defaultFont)
QVariantMap AWActions::getFont(const QVariantMap defaultFont) const
{
if (debug) qDebug() << PDEBUG;
@ -169,7 +169,7 @@ QVariantMap AWActions::getFont(const QVariantMap defaultFont)
}
QVariantMap AWActions::readDataEngineConfiguration()
QVariantMap AWActions::readDataEngineConfiguration() const
{
if (debug) qDebug() << PDEBUG;
@ -193,7 +193,7 @@ QVariantMap AWActions::readDataEngineConfiguration()
}
void AWActions::writeDataEngineConfiguration(const QVariantMap configuration)
void AWActions::writeDataEngineConfiguration(const QVariantMap configuration) const
{
if (debug) qDebug() << PDEBUG;
@ -216,7 +216,8 @@ void AWActions::writeDataEngineConfiguration(const QVariantMap configuration)
}
void AWActions::sendNotification(const QString eventId, const QString message, const bool enablePopup)
void AWActions::sendNotification(const QString eventId, const QString message,
const bool enablePopup)
{
if ((eventId == QString("event")) && (!enablePopup)) return;
@ -225,7 +226,7 @@ void AWActions::sendNotification(const QString eventId, const QString message, c
}
void AWActions::showUpdates(QString version)
void AWActions::showUpdates(QString version) const
{
if (debug) qDebug() << PDEBUG;
@ -244,7 +245,7 @@ void AWActions::showUpdates(QString version)
}
void AWActions::versionReplyRecieved(QNetworkReply *reply)
void AWActions::versionReplyRecieved(QNetworkReply *reply) const
{
if (debug) qDebug() << PDEBUG;

View File

@ -35,25 +35,25 @@ public:
~AWActions();
Q_INVOKABLE void checkUpdates();
Q_INVOKABLE bool dropCache();
Q_INVOKABLE bool isDebugEnabled();
Q_INVOKABLE void runCmd(const QString cmd = QString("/usr/bin/true"));
Q_INVOKABLE void sendEmail();
Q_INVOKABLE void showReadme();
Q_INVOKABLE bool dropCache() const;
Q_INVOKABLE bool isDebugEnabled() const;
Q_INVOKABLE void runCmd(const QString cmd = QString("/usr/bin/true")) const;
Q_INVOKABLE void sendEmail() const;
Q_INVOKABLE void showReadme() const;
// configuration slots
Q_INVOKABLE QString getAboutText(const QString type = QString("header"));
Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont);
Q_INVOKABLE QString getAboutText(const QString type = QString("header")) const;
Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont) const;
// dataengine
Q_INVOKABLE QVariantMap readDataEngineConfiguration();
Q_INVOKABLE void writeDataEngineConfiguration(const QVariantMap configuration);
Q_INVOKABLE QVariantMap readDataEngineConfiguration() const;
Q_INVOKABLE void writeDataEngineConfiguration(const QVariantMap configuration) const;
public slots:
Q_INVOKABLE static void sendNotification(const QString eventId, const QString message,
const bool enablePopup = false);
private slots:
void showUpdates(QString version);
void versionReplyRecieved(QNetworkReply *reply);
void showUpdates(QString version) const;
void versionReplyRecieved(QNetworkReply *reply) const;
private:
// variables

View File

@ -139,7 +139,7 @@ void AWKeys::setWrapNewLines(const bool wrap)
}
QString AWKeys::parsePattern()
QString AWKeys::parsePattern() const
{
if (debug) qDebug() << PDEBUG;
if (keys.isEmpty()) return pattern;
@ -158,7 +158,7 @@ QString AWKeys::parsePattern()
}
QSize AWKeys::toolTipSize()
QSize AWKeys::toolTipSize() const
{
if (debug) qDebug() << PDEBUG;
if (toolTip == nullptr) return QSize();
@ -190,7 +190,7 @@ void AWKeys::addDevice(const QString source)
}
QStringList AWKeys::dictKeys(const bool sorted)
QStringList AWKeys::dictKeys(const bool sorted) const
{
if (debug) qDebug() << PDEBUG;
@ -339,7 +339,7 @@ QStringList AWKeys::dictKeys(const bool sorted)
}
QStringList AWKeys::getHddDevices()
QStringList AWKeys::getHddDevices() const
{
if (debug) qDebug() << PDEBUG;
@ -689,7 +689,7 @@ void AWKeys::setDataBySource(const QString sourceName, const QVariantMap data,
}
void AWKeys::graphicalValueByKey()
void AWKeys::graphicalValueByKey() const
{
if (debug) qDebug() << PDEBUG;
@ -706,7 +706,7 @@ void AWKeys::graphicalValueByKey()
}
QString AWKeys::infoByKey(QString key)
QString AWKeys::infoByKey(QString key) const
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key;
@ -742,7 +742,7 @@ QString AWKeys::infoByKey(QString key)
}
QString AWKeys::valueByKey(QString key)
QString AWKeys::valueByKey(QString key) const
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key;
@ -822,7 +822,7 @@ void AWKeys::editItem(const QString type)
}
void AWKeys::dataUpdate()
void AWKeys::dataUpdate() const
{
if (debug) qDebug() << PDEBUG;
@ -1390,7 +1390,7 @@ void AWKeys::addKeyToCache(const QString type, const QString key)
}
bool AWKeys::checkKeys(const QVariantMap data)
bool AWKeys::checkKeys(const QVariantMap data) const
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Data" << data;
@ -1399,7 +1399,7 @@ bool AWKeys::checkKeys(const QVariantMap data)
}
QString AWKeys::htmlValue(QString key)
QString AWKeys::htmlValue(QString key) const
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key;
@ -1411,7 +1411,7 @@ QString AWKeys::htmlValue(QString key)
}
int AWKeys::numberCpus()
int AWKeys::numberCpus() const
{
if (debug) qDebug() << PDEBUG;
@ -1419,7 +1419,7 @@ int AWKeys::numberCpus()
}
float AWKeys::temperature(const float temp, const QString units)
float AWKeys::temperature(const float temp, const QString units) const
{
if (debug) qDebug() << PDEBUG;
@ -1443,7 +1443,7 @@ float AWKeys::temperature(const float temp, const QString units)
}
QString AWKeys::toolTipImage()
QString AWKeys::toolTipImage() const
{
if(debug) qDebug() << PDEBUG;
if (toolTip == nullptr) return QString("");
@ -1459,7 +1459,7 @@ QString AWKeys::toolTipImage()
}
QStringList AWKeys::findGraphicalItems()
QStringList AWKeys::findGraphicalItems() const
{
if (debug) qDebug() << PDEBUG;
@ -1479,7 +1479,7 @@ QStringList AWKeys::findGraphicalItems()
}
QStringList AWKeys::findKeys()
QStringList AWKeys::findKeys() const
{
QStringList selectedKeys;
for (int i=0; i<keys.count(); i++) {
@ -1649,7 +1649,7 @@ QList<GraphicalItem *> AWKeys::getGraphicalItems()
}
GraphicalItem *AWKeys::getItemByTag(const QString tag)
GraphicalItem *AWKeys::getItemByTag(const QString tag) const
{
if (debug) qDebug() << PDEBUG;
@ -1664,7 +1664,7 @@ GraphicalItem *AWKeys::getItemByTag(const QString tag)
}
QStringList AWKeys::getTimeKeys()
QStringList AWKeys::getTimeKeys() const
{
if (debug) qDebug() << PDEBUG;

View File

@ -57,29 +57,29 @@ public:
Q_INVOKABLE void initTooltip(const QVariantMap tooltipParams);
Q_INVOKABLE void setPopupEnabled(const bool popup = false);
Q_INVOKABLE void setWrapNewLines(const bool wrap = false);
Q_INVOKABLE QString parsePattern();
Q_INVOKABLE QSize toolTipSize();
Q_INVOKABLE QString parsePattern() const;
Q_INVOKABLE QSize toolTipSize() const;
// keys
Q_INVOKABLE void addDevice(const QString source);
Q_INVOKABLE QStringList dictKeys(const bool sorted = false);
Q_INVOKABLE QStringList getHddDevices();
Q_INVOKABLE QStringList dictKeys(const bool sorted = false) const;
Q_INVOKABLE QStringList getHddDevices() const;
Q_INVOKABLE void setDataBySource(const QString sourceName, const QVariantMap data,
const QVariantMap params);
// values
Q_INVOKABLE void graphicalValueByKey();
Q_INVOKABLE QString infoByKey(QString key);
Q_INVOKABLE QString valueByKey(QString key);
Q_INVOKABLE void graphicalValueByKey() const;
Q_INVOKABLE QString infoByKey(QString key) const;
Q_INVOKABLE QString valueByKey(QString key) const;
// configuration
Q_INVOKABLE void editItem(const QString type);
signals:
void dropSourceFromDataengine(const QString source);
void needTextToBeUpdated(const QString newText);
void needToolTipToBeUpdated(const QString newText);
void needTextToBeUpdated(const QString newText) const;
void needToolTipToBeUpdated(const QString newText) const;
void needToBeUpdated();
private slots:
void dataUpdate();
void dataUpdate() const;
void loadKeysFromCache();
void reinitKeys();
// editor
@ -93,22 +93,22 @@ private slots:
private:
// methods
void addKeyToCache(const QString type, const QString key = QString(""));
bool checkKeys(const QVariantMap data);
QString htmlValue(QString key);
int numberCpus();
float temperature(const float temp, const QString units);
QString toolTipImage();
bool checkKeys(const QVariantMap data) const;
QString htmlValue(QString key) const;
int numberCpus() const;
float temperature(const float temp, const QString units) const;
QString toolTipImage() const;
// find methods
QStringList findGraphicalItems();
QStringList findKeys();
QStringList findGraphicalItems() const;
QStringList findKeys() const;
// get methods
QList<ExtQuotes *> getExtQuotes();
QList<ExtScript *> getExtScripts();
QList<ExtUpgrade *> getExtUpgrade();
QList<ExtWeather *> getExtWeather();
QList<GraphicalItem *> getGraphicalItems();
GraphicalItem *getItemByTag(const QString tag);
QStringList getTimeKeys();
GraphicalItem *getItemByTag(const QString tag) const;
QStringList getTimeKeys() const;
AWToolTip *toolTip = nullptr;
// graphical elements
QDialog *dialog = nullptr;

View File

@ -76,7 +76,7 @@ AWToolTip::~AWToolTip()
}
QSize AWToolTip::getSize()
QSize AWToolTip::getSize() const
{
if (debug) qDebug() << PDEBUG;

View File

@ -35,7 +35,7 @@ public:
AWToolTip(QObject *parent = nullptr, QVariantMap settings = QVariantMap());
~AWToolTip();
QSize getSize();
QSize getSize() const;
QPixmap image();
void setData(const QString source, float value,
const bool ac = true);