~valavanisalex/ubuntu/maverick/scidavis/fix-604811

« back to all changes in this revision

Viewing changes to scidavis/src/globals.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Ruben Molina
  • Date: 2009-09-06 11:34:04 UTC
  • Revision ID: james.westby@ubuntu.com-20090906113404-4awaey82l3686w4q
Tags: upstream-0.2.3
Import upstream version 0.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
    File                 : globals.cpp
 
3
    Description          : Definition of global constants and enums
 
4
    --------------------------------------------------------------------
 
5
    Copyright            : (C) 2006-2009 Tilman Benkert (thzs*gmx.net)
 
6
    Copyright            : (C) 2006-2007 Ion Vasilief (ion_vasilief*yahoo.fr)
 
7
                           (replace * with @ in the email addresses) 
 
8
 
 
9
 ***************************************************************************/
 
10
 
 
11
#include "globals.h"
 
12
#include <QMessageBox>
 
13
#include <QIcon>
 
14
#include <QObject>
 
15
#include <QMetaObject>
 
16
#include <QMetaEnum>
 
17
#include <QtDebug>
 
18
#include "ui_SciDAVisAbout.h"
 
19
 
 
20
//  Don't forget to change the Doxyfile, the splash screen and the Windows
 
21
//  installer when changing these!
 
22
const int SciDAVis::scidavis_version = 0x000203;
 
23
 
 
24
const char * SciDAVis::extra_version = "";
 
25
 
 
26
const char * SciDAVis::copyright_string = "\
 
27
=== Credits ===\n\
 
28
\n\
 
29
--- Developers ---\n\
 
30
\n\
 
31
The following people have written parts of the SciDAVis source code, ranging from a few lines to large chunks.\n\
 
32
In alphabetical order.\n\
 
33
\n\
 
34
Tilman Benkert[1], Knut Franke\n\
 
35
\n\
 
36
--- Documentation ---\n\
 
37
\n\
 
38
The following people have written parts of the manual and/or other documentation.\n\
 
39
In alphabetical order.\n\
 
40
\n\
 
41
Knut Franke, Roger Gadiou\n\
 
42
\n\
 
43
--- Translations ---\n\
 
44
\n\
 
45
The following people have contributed translations or parts thereof.\n\
 
46
In alphabetical order.\n\
 
47
\n\
 
48
Tilman Benkert[1], Markus Bongard, Tobias Burnus, R�my Claverie, f0ma, Jos� Antonio Lorenzo Fern�ndez, \
 
49
Daniel Klaer, Peter Landgren, Fellype do Nascimento, Tomomasa Ohkubo, Mikhail Shevyakov, Mauricio Troviano\n\
 
50
\n\
 
51
--- Packagers ---\n\
 
52
\n\
 
53
The following people have made installing SciDAVis easier by providing specialized binary packages.\n\
 
54
In alphabetical order.\n\
 
55
\n\
 
56
Burkhard Bunk (Debian), Quentin Denis (SUSE), Yu-Hung Lien (Mac OS X), Fellype do Nascimento (Slackware), \
 
57
Eric Tanguy (Fedora), Mauricio Troviano (Windows installer)\n\
 
58
\n\
 
59
--- QtiPlot ---\n\
 
60
\n\
 
61
SciDAVis uses code from QtiPlot, which consisted (at the time of the fork, i.e. QtiPlot 0.9-rc2) of code by the following people:\n\
 
62
\n\
 
63
Tilman Benkert[1], Shen Chen, Borries Demeler, Jos� Antonio Lorenzo Fern�ndez, Knut Franke, Vasileios Gkanis, Gudjon Gudjonsson, \
 
64
Alex Kargovsky, Michael Mac-Vicar, Tomomasa Ohkubo, Aaron Van Tassle, Branimir Vasilic, Ion Vasilief, Vincent Wagelaar\n\
 
65
\n\
 
66
The SciDAVis manual is based on the QtiPlot manual, written by (in alphabetical order):\n\
 
67
\n\
 
68
Knut Franke, Roger Gadiou, Ion Vasilief\n\
 
69
\n\
 
70
footnotes:\n\
 
71
[1] birth name: Tilman H�ner zu Siederdissen\n\
 
72
\n\
 
73
=== Special Thanks ===\n\
 
74
\n\
 
75
We also want to acknowledge the people having helped us indirectly by contributing to the following\n\
 
76
fine pieces of software. In no particular order.\n\
 
77
\n\
 
78
Qt (http://doc.trolltech.com/4.3/credits.html),\n\
 
79
Qwt (http://qwt.sourceforge.net/#credits),\n\
 
80
Qwtplot3D (http://qwtplot3d.sourceforge.net/),\n\
 
81
muParser (http://muparser.sourceforge.net/),\n\
 
82
Python (http://www.python.org/),\n\
 
83
liborigin (http://sourceforge.net/projects/liborigin/),\n\
 
84
Vim (http://www.vim.org/thanks.php/),\n\
 
85
webgen (http://webgen.rubyforge.org/),\n\
 
86
Doxygen (http://www.doxygen.org/),\n\
 
87
Subversion (http://subversion.tigris.org/),\n\
 
88
GSL (http://www.gnu.org/software/gsl/)\n\
 
89
\n\
 
90
... and many more we just forgot to mention.\n";
 
91
 
 
92
const char * SciDAVis::release_date = " 2009-07-05";
 
93
 
 
94
int SciDAVis::version()
 
95
{
 
96
        return scidavis_version;
 
97
}
 
98
 
 
99
QString SciDAVis::versionString()
 
100
{
 
101
        return "SciDAVis " + 
 
102
                        QString::number((scidavis_version & 0xFF0000) >> 16)+"."+ 
 
103
                        QString::number((scidavis_version & 0x00FF00) >> 8)+"."+
 
104
                        QString::number(scidavis_version & 0x0000FF);
 
105
}
 
106
                        
 
107
QString SciDAVis::extraVersion()
 
108
{
 
109
        return  QString(extra_version);
 
110
}
 
111
 
 
112
void SciDAVis::about()
 
113
{
 
114
        QString text = QString(SciDAVis::copyright_string);
 
115
        text.replace(QRegExp("\\[1\\]"), "<sup>1</sup>");
 
116
        text.replace("�","&eacute;");
 
117
        text.replace("�","&aacute;");
 
118
        text.replace("�", "&ouml;");
 
119
        text.replace("\n", "<br>");
 
120
        text.replace("=== ", "<h1>");
 
121
        text.replace(" ===","</h1>");
 
122
        text.replace("--- ", "<h2>");
 
123
        text.replace(" ---","</h2>");
 
124
        text.replace(" ---","</h2>");
 
125
        text.replace("</h1><br><br>", "</h1>");
 
126
        text.replace("</h2><br><br>", "</h2>");
 
127
        text.replace("<br><h1>", "<h1>");
 
128
        text.replace("<br><h2>", "<h2>");
 
129
 
 
130
        QDialog *dialog = new QDialog();
 
131
        Ui::SciDAVisAbout ui;
 
132
        ui.setupUi(dialog);
 
133
        dialog->setAttribute(Qt::WA_DeleteOnClose);
 
134
        dialog->setWindowTitle(QObject::tr("About SciDAVis"));
 
135
        ui.version_label->setText(versionString() + extraVersion());
 
136
        ui.release_date_label->setText(QObject::tr("Released") + ": " + QString(SciDAVis::release_date));
 
137
        ui.credits_box->setHtml(text);
 
138
 
 
139
        dialog->exec();
 
140
}
 
141
 
 
142
QString SciDAVis::copyrightString()
 
143
{
 
144
        return copyright_string;
 
145
}
 
146
 
 
147
QString SciDAVis::releaseDateString()
 
148
{
 
149
        return release_date;
 
150
}
 
151
 
 
152
QString SciDAVis::enumValueToString(int key, const QString& enum_name)
 
153
{
 
154
        int index = staticMetaObject.indexOfEnumerator(enum_name.toAscii());
 
155
        if(index == -1) return QString("invalid");
 
156
        QMetaEnum meta_enum = staticMetaObject.enumerator(index);
 
157
        return QString(meta_enum.valueToKey(key));
 
158
}
 
159
 
 
160
int SciDAVis::enumStringToValue(const QString& string, const QString& enum_name)
 
161
{
 
162
        int index = staticMetaObject.indexOfEnumerator(enum_name.toAscii());
 
163
        if(index == -1) return -1;
 
164
        QMetaEnum meta_enum = staticMetaObject.enumerator(index);
 
165
        return meta_enum.keyToValue(string.toAscii());
 
166
}
 
167