kde-workspace/plasma/applets/system-monitor/temperature.h
Ivailo Monev e661a0c257 plasma: implement configuration interface for the system-monitor applet temperature unit
includes support for Kelvin unit

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-12 21:00:12 +03:00

69 lines
2.1 KiB
C++

/*
* Copyright (C) 2007 Petri Damsten <damu@iki.fi>
* Copyright (C) 2010 Michel Lafon-Puyo <michel.lafonpuyo@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License version 2 as
* published by the Free Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef TEMPERATURE_HEADER
#define TEMPERATURE_HEADER
#include <applet.h>
#include "ui_temperature-config.h"
#include <KUnitConversion>
#include <Plasma/DataEngine>
#include <QStandardItemModel>
#include <QTimer>
namespace Plasma {
class Meter;
}
class Temperature : public SM::Applet
{
Q_OBJECT
public:
Temperature(QObject *parent, const QVariantList &args);
~Temperature();
virtual void init();
public slots:
void configChanged();
void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data);
void createConfigurationInterface(KConfigDialog *parent);
private slots:
void configAccepted();
void sourceAdded(const QString& name);
void sourcesAdded();
private:
Ui::config ui;
QStandardItemModel m_tempModel;
QStringList m_sources;
QTimer m_sourceTimer;
QRegExp m_rx;
QString temperatureTitle(const QString& source);
double temperatureOffset(const QString& source);
KTemperature::KTempUnit temperatureUnit();
bool addVisualization(const QString& source);
bool isValidDevice(const QString& uuid, Plasma::DataEngine::Data* data);
};
K_EXPORT_PLASMA_APPLET(sm_temperature, Temperature)
#endif