2015-01-15 17:07:43 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
* Copyright (C) 2008 by Gerhard Gappmeier <gerhard.gappmeier@ascolab.com> *
|
|
|
|
* Copyright (C) 2009 by Petri Damstén <damu@iki.fi> *
|
|
|
|
* *
|
|
|
|
* This program 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 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* 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 General Public License *
|
|
|
|
* along with this program; if not, write to the *
|
|
|
|
* Free Software Foundation, Inc., *
|
|
|
|
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef UNITCONVERTER_H
|
|
|
|
#define UNITCONVERTER_H
|
|
|
|
|
|
|
|
#include <Plasma/PopupApplet>
|
|
|
|
#include <Plasma/ComboBox>
|
2024-05-20 11:20:48 +03:00
|
|
|
#include <Plasma/SpinBox>
|
2015-01-15 17:07:43 +00:00
|
|
|
|
|
|
|
class ComboBox : public Plasma::ComboBox
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
ComboBox(QGraphicsWidget* parent = 0);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void mousePressed();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void mousePressEvent(QGraphicsSceneMouseEvent* event);
|
|
|
|
};
|
|
|
|
|
|
|
|
// Define our plasma Applet
|
|
|
|
class UnitConverter : public Plasma::PopupApplet
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
// Basic Create/Destroy
|
|
|
|
UnitConverter(QObject *parent, const QVariantList &args);
|
|
|
|
~UnitConverter();
|
|
|
|
|
|
|
|
virtual QGraphicsWidget *graphicsWidget();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void configChanged();
|
|
|
|
|
|
|
|
private slots:
|
2024-05-20 11:20:48 +03:00
|
|
|
void sltValueChanged(const int iNewValue);
|
|
|
|
void sltValueChangedReverse(const int iNewValue);
|
2015-01-15 17:07:43 +00:00
|
|
|
void sltUnitChanged(int index);
|
|
|
|
void sltCategoryChanged(int index);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void calculate();
|
|
|
|
void calculateReverse();
|
|
|
|
|
|
|
|
private:
|
2024-05-20 11:20:48 +03:00
|
|
|
QGraphicsWidget* m_widget;
|
|
|
|
Plasma::ComboBox* m_pCmbCategory;
|
|
|
|
Plasma::ComboBox* m_pCmbUnit1;
|
|
|
|
Plasma::ComboBox* m_pCmbUnit2;
|
|
|
|
Plasma::SpinBox* m_pSpnValue1;
|
|
|
|
Plasma::SpinBox* m_pSpnValue2;
|
|
|
|
bool m_bCalculateReverse;
|
2015-01-15 17:07:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// This is the command that links your applet to the .desktop file
|
|
|
|
K_EXPORT_PLASMA_APPLET(unitconverter, UnitConverter)
|
|
|
|
|
|
|
|
#endif // _UNITCONVERTER_H_
|