1
/***********************************************************************************
2
* Mass calculator: Plasmoid to calculate mass of a Molecule.
3
* Copyright (C) 2009, 2010 Etienne Rebetez, etienne.rebetez@oberwallis.ch
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
***********************************************************************************/
21
// Here we avoid loading the header multiple times
22
#ifndef periodicTable_HEADER
23
#define periodicTable_HEADER
25
#include <QGraphicsGridLayout>
28
// We need the Plasma Applet headers
29
#include <plasma/widgets/label.h>
30
#include <plasma/widgets/lineedit.h>
31
#include <plasma/widgets/iconwidget.h>
32
#include <plasma/popupapplet.h>
34
#include "ui_Molmassconfig.h"
36
#include "Periodictable.h"
39
// Define our plasma Applet
40
class Molmasscalculator : public Plasma::PopupApplet
44
// Basic Create/Destroy
45
Molmasscalculator ( QObject *parent, const QVariantList &args );
48
/// Returns the GraphicsWidget used by the plasmoid
49
QGraphicsWidget *graphicsWidget ();
51
/// loads the settings.
55
/// Appens the given String to the lineedit text and let it parse by ParseMolecule.
56
void appendElement ( QString ElementSymbol );
61
///Sends the requests to the Dataengine
62
void ParseMolecule( QString molecule );
64
///The lineEdit Text is parsed.
70
void configAccepted();
73
void createConfigurationInterface (KConfigDialog* parent);
76
/// Sets the new Mass and Molecule after a calculation.
77
void newCalculatedMass();
79
///Resets the size of the plasmoid if the periodsystem is shown or not.
80
void managePeriodSystem();
85
bool m_showPeriodicTable;
86
bool m_copyToClipboard;
90
QGraphicsWidget *m_widget;
91
PeriodicGrid *m_PeriodWidget;
93
QTimer *m_triggerTimer;
95
Plasma::LineEdit *m_lineedit;
96
Plasma::Label *m_MassLabel;
97
Plasma::IconWidget *m_switchButton;
99
Plasma::DataEngine::Data m_molecule;
101
Ui::periodicConfig m_ui;
104
// This is the command that links your applet to the .desktop file
105
K_EXPORT_PLASMA_APPLET ( Molmasscalculator, Molmasscalculator )