mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 07:57:19 +00:00
126 lines
4.2 KiB
C++
126 lines
4.2 KiB
C++
/***************************************************************************
|
|
* This file is part of pytextmonitor *
|
|
* *
|
|
* pytextmonitor is free software: you can redistribute it and/or *
|
|
* modify it under the terms of the GNU General Public License as *
|
|
* published by the Free Software Foundation, either version 3 of the *
|
|
* License, or (at your option) any later version. *
|
|
* *
|
|
* pytextmonitor 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 General Public License *
|
|
* along with pytextmonitor. If not, see http://www.gnu.org/licenses/ *
|
|
***************************************************************************/
|
|
|
|
|
|
#ifndef AWESOME_WIDGET_H
|
|
#define AWESOME_WIDGET_H
|
|
|
|
#include <Plasma/Applet>
|
|
#include <Plasma/DataEngine>
|
|
#include <Plasma/ToolTipContent>
|
|
|
|
#include <ui_advanced.h>
|
|
#include <ui_appearance.h>
|
|
#include <ui_deconfig.h>
|
|
#include <ui_tooltipconfig.h>
|
|
#include <ui_widget.h>
|
|
|
|
|
|
class CustomLabel;
|
|
class QGraphicsLinearLayout;
|
|
class QGraphicsScene;
|
|
|
|
class AwesomeWidget : public Plasma::Applet
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
AwesomeWidget(QObject *parent, const QVariantList &args);
|
|
~AwesomeWidget();
|
|
QString getNetworkDevice();
|
|
int getNumberCpus();
|
|
float getTemp(const float temp);
|
|
QStringList getTimeKeys();
|
|
void init();
|
|
// de configuration
|
|
QMap<QString, QString> readDataEngineConfiguration();
|
|
void writeDataEngineConfiguration(const QMap<QString, QString> settings);
|
|
QMap<QString, QString> updateDataEngineConfiguration(const QMap<QString, QString> rawConfig);
|
|
|
|
public slots:
|
|
// contextual actions
|
|
void showKsysguard();
|
|
void showReadme();
|
|
// dataengine
|
|
void addDiskDevice(const QString source);
|
|
void connectToEngine();
|
|
void dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data);
|
|
void disconnectFromEngine();
|
|
// configuration interface
|
|
void configAccepted();
|
|
void configChanged();
|
|
// update events
|
|
void updateNetworkDevice();
|
|
void updateText(bool clear = false);
|
|
void updateTooltip();
|
|
|
|
private slots:
|
|
void reinit();
|
|
// configuration interface
|
|
void addNewCustomCommand(QTableWidgetItem *item);
|
|
void addNewPkgCommand(QTableWidgetItem *item);
|
|
void contextMenuCustomCommand(const QPoint pos);
|
|
void contextMenuPkgCommand(const QPoint pos);
|
|
void editHddItem(QListWidgetItem *item);
|
|
void editHddSpeedItem(QListWidgetItem *item);
|
|
void editMountItem(QListWidgetItem *item);
|
|
void editTempItem(QListWidgetItem *item);
|
|
|
|
protected:
|
|
QList<QAction *> contextualActions();
|
|
void createConfigurationInterface(KConfigDialog *parent);
|
|
|
|
private:
|
|
// functions
|
|
void createActions();
|
|
void initValues();
|
|
QStringList findKeys();
|
|
QStringList getKeys();
|
|
// ui
|
|
QGraphicsLinearLayout *mainLayout;
|
|
CustomLabel *textLabel;
|
|
QTimer *timer;
|
|
QList<QAction *> contextMenu;
|
|
// tooltip
|
|
Plasma::ToolTipContent toolTip;
|
|
QGraphicsScene *toolTipScene;
|
|
QGraphicsView *toolTipView;
|
|
// values
|
|
int networkDeviceUpdate;
|
|
QMap<QString, int> counts;
|
|
QMap<QString, QList<float>> tooltipValues;
|
|
QMap<QString, QString> values;
|
|
// debug
|
|
bool debug;
|
|
// data engine
|
|
Plasma::DataEngine *extsysmonEngine;
|
|
Plasma::DataEngine *sysmonEngine;
|
|
Plasma::DataEngine *timeEngine;
|
|
// configuration interface
|
|
Ui::AdvancedWindow uiAdvancedConfig;
|
|
Ui::AppearanceWindow uiAppConfig;
|
|
Ui::ConfigWindow uiWidConfig;
|
|
Ui::DEWindow uiDEConfig;
|
|
Ui::TooltipWindow uiTooltipConfig;
|
|
// configuration
|
|
QMap<QString, QString> configuration;
|
|
QStringList diskDevices, keys, formatLine, foundKeys;
|
|
};
|
|
|
|
|
|
#endif /* AWESOME_WIDGET_H */
|