2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // + This file is part of enGrid. +
6 // + Copyright 2008,2009 Oliver Gloth +
8 // + enGrid is free software: you can redistribute it and/or modify +
9 // + it under the terms of the GNU General Public License as published by +
10 // + the Free Software Foundation, either version 3 of the License, or +
11 // + (at your option) any later version. +
13 // + enGrid is distributed in the hope that it will be useful, +
14 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 // + GNU General Public License for more details. +
18 // + You should have received a copy of the GNU General Public License +
19 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
25 #include <QApplication>
27 #include <QTextStream>
30 #include "guimainwindow.h"
32 void makeDistribution()
36 int main( int argc
, char ** argv
)
39 if (QString(argv
[1]) == QString("-appendlic")) {
40 int first_year
= 2008;
41 QString first_year_text
;
42 first_year_text
.setNum(first_year
);
43 int year
= QDate::currentDate().year();
45 year_text
.setNum(year
);
46 if (year
-first_year
== 1) {
47 year_text
= first_year_text
+ "," + year_text
;
49 if (year
-first_year
> 1) {
50 year_text
= first_year_text
+ "-" + year_text
;
52 QString year_end_text
= " +\n";
53 if (year
== first_year
) {
54 year_end_text
= " " + year_end_text
;
56 for (int i
= 2; i
< argc
; ++i
) {
57 QString
filename(argv
[i
]);
58 QString buffer
= "//\n";
59 buffer
+= "// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
61 buffer
+= "// + This file is part of enGrid. +\n";
63 buffer
+= "// + Copyright " + year_text
+ " Oliver Gloth" + year_end_text
;
65 buffer
+= "// + enGrid is free software: you can redistribute it and/or modify +\n";
66 buffer
+= "// + it under the terms of the GNU General Public License as published by +\n";
67 buffer
+= "// + the Free Software Foundation, either version 3 of the License, or +\n";
68 buffer
+= "// + (at your option) any later version. +\n";
70 buffer
+= "// + enGrid is distributed in the hope that it will be useful, +\n";
71 buffer
+= "// + but WITHOUT ANY WARRANTY; without even the implied warranty of +\n";
72 buffer
+= "// + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +\n";
73 buffer
+= "// + GNU General Public License for more details. +\n";
75 buffer
+= "// + You should have received a copy of the GNU General Public License +\n";
76 buffer
+= "// + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +\n";
78 buffer
+= "// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
81 bool src_code
= false;
83 file
.open(QIODevice::ReadOnly
);
86 QString line
= f
.readLine();
88 if (line
.size() >= 2) {
89 if (line
.left(2) != "//") {
97 buffer
+= line
+ "\n";
102 QFile
file(filename
);
103 file
.open(QIODevice::WriteOnly
);
104 QTextStream
f(&file
);
109 if (QString(argv
[1]) == QString("-distbin")) {
110 system ("ldd ./engrid > ldd.out");
111 system ("mkdir enGrid");
112 system ("cp engrid enGrid");
113 system ("cp start_engrid enGrid");
115 QFile
file("ldd.out");
116 file
.open(QIODevice::ReadOnly
);
117 QTextStream
f(&file
);
119 QString line
= f
.readLine();
120 QTextStream
l(&line
, QIODevice::ReadOnly
);
123 if (word
.left(1) != "/") {
127 QString cmd
= "cp " + word
+ " enGrid";
128 system(cmd
.toAscii().data());
129 cout
<< cmd
.toAscii().data() << endl
;
132 system ("tar czf enGrid_bin.tar.gz enGrid/*");
133 system ("rm -rf enGrid");
134 system ("rm ldd.out");
137 QApplication
a( argc
, argv
);
140 a
.connect( &a
, SIGNAL( lastWindowClosed() ), &a
, SLOT( quit() ) );