~ubuntu-branches/ubuntu/precise/kalzium/precise

« back to all changes in this revision

Viewing changes to src/detailinfodlg.h

  • Committer: Bazaar Package Importer
  • Author(s): Philip Muškovac
  • Date: 2011-07-03 12:28:58 UTC
  • Revision ID: james.westby@ubuntu.com-20110703122858-q1yyxncs89e4w0hs
Tags: upstream-4.6.90+repack
Import upstream version 4.6.90+repack

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
    begin                : Tue Apr 2 20:43:44 2002 UTC
 
3
    copyright            : (C) 2003, 2004, 2005, 2006 by Carsten Niehaus
 
4
    email                : cniehaus@kde.org
 
5
 ***************************************************************************/
 
6
 
 
7
/***************************************************************************
 
8
 *                                                                         *
 
9
 *   This program is free software; you can redistribute it and/or modify  *
 
10
 *   it under the terms of the GNU General Public License as published by  *
 
11
 *   the Free Software Foundation; either version 2 of the License, or     *
 
12
 *   (at your option) any later version.                                   *
 
13
 *                                                                         *
 
14
 ***************************************************************************/
 
15
 
 
16
#ifndef DETAILINFODLG_H
 
17
#define DETAILINFODLG_H
 
18
 
 
19
#include <kpagedialog.h>
 
20
 
 
21
#include <QMap>
 
22
 
 
23
class DetailedGraphicalOverview;
 
24
class Element;
 
25
class KalziumTableType;
 
26
class OrbitsWidget;
 
27
class SpectrumViewImpl;
 
28
 
 
29
class QLabel;
 
30
class QStackedWidget;
 
31
class KActionCollection;
 
32
class KHTMLPart;
 
33
 
 
34
/**
 
35
 * @brief The dialog which shows all available information of an element
 
36
 * @author Carsten Niehaus
 
37
 */
 
38
class DetailedInfoDlg : public KPageDialog
 
39
{
 
40
    Q_OBJECT
 
41
 
 
42
public:
 
43
    explicit DetailedInfoDlg( int el, QWidget *parent = 0 );
 
44
    ~DetailedInfoDlg();
 
45
 
 
46
    void setElement( int el );
 
47
 
 
48
//     void setOverviewBackgroundColor( const QColor &bgColor );
 
49
 
 
50
    void setTableType( int ktt );
 
51
 
 
52
    /**
 
53
     * add <sup></sup> to the numbers
 
54
     @return the beatified string
 
55
     */
 
56
    QString beautifyOrbitalString(const QString& orbits);
 
57
 
 
58
private:
 
59
    enum DATATYPE
 
60
    {
 
61
        MISC = 0,
 
62
        ISOTOPES,
 
63
        DATA, /** <the overview about atomic and compound data */
 
64
        EXTRA/** Links to wikipedia and other sites where useful information can be found*/
 
65
    };
 
66
 
 
67
    Element            *m_element;
 
68
    int                m_elementNumber;
 
69
 
 
70
    KActionCollection* m_actionCollection;
 
71
 
 
72
    SpectrumViewImpl *m_spectrumview;
 
73
    QStackedWidget* m_spectrumStack;
 
74
    QLabel* m_spectrumLabel;
 
75
 
 
76
    QString isotopeTable() const;
 
77
 
 
78
    DetailedGraphicalOverview *dTab;
 
79
//X             QLabel *piclabel;
 
80
    OrbitsWidget *wOrbits;
 
81
    QMap<QString, KHTMLPart*> m_htmlpages;
 
82
 
 
83
    int m_tableTyp;
 
84
 
 
85
    /**
 
86
     * Create the initial set of tabs. Used it *ONLY* once in the
 
87
     * constructor.
 
88
     */
 
89
    void createContent();
 
90
    void reloadContent();
 
91
 
 
92
    QString getHtml( DATATYPE );
 
93
 
 
94
    QString m_baseHtml;
 
95
    QString m_baseHtml2;
 
96
//X             QString m_picsdir;
 
97
 
 
98
    /**
 
99
     * Add a new HTML page to the dialog.
 
100
     *
 
101
     * @param title The title of the tab, appears above the htmlview
 
102
     * @param icontext The name of the tab, appears belov or instead
 
103
     * of the icon
 
104
     * @param iconname The name of the icon
 
105
     * @returns the pointer to the resulting KHTMLPart, needed for
 
106
     * writing HTML code on it
 
107
     */
 
108
    KHTMLPart* addHTMLTab( const QString& title, const QString& icontext, const QString& iconname );
 
109
    /**
 
110
     * Change the HTML code in an HTML page.
 
111
     *
 
112
     * @param htmlpart the KHTMLPart to edit
 
113
     * @param htmlcode the HTML code to display
 
114
     */
 
115
    void fillHTMLTab( KHTMLPart* htmlpart, const QString& htmlcode );
 
116
 
 
117
    /**
 
118
     * Creates a localized link to Wikipedia.
 
119
     * http://en.wikipedia.org/wiki/link"
 
120
     * @param link the link inside wikipedia
 
121
     * @param displayString the displayed string to click on.
 
122
     */
 
123
    QString createWikiLink( QString link, QString displayString);
 
124
 
 
125
    /// overloaded function to add link as the displayed String
 
126
    QString createWikiLink( QString link );
 
127
 
 
128
private slots:
 
129
    void slotLinkClicked(const KUrl &url);
 
130
 
 
131
    virtual void slotUser1();
 
132
    virtual void slotUser2();
 
133
    /**
 
134
     * invoke the help of the correct chapter
 
135
     */
 
136
    virtual void slotHelp();
 
137
 
 
138
signals:
 
139
    void elementChanged( int );
 
140
};
 
141
 
 
142
#endif