File: AboutDialog.cpp

package info (click to toggle)
subcommander 2.0.0~b5p2-5
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 15,344 kB
  • sloc: cpp: 63,594; sh: 4,050; xml: 1,992; makefile: 1,134; ansic: 786; ruby: 251; lisp: 24
file content (367 lines) | stat: -rw-r--r-- 11,579 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
/**
 * ==========================================================================
 * Copyright (c) 2003-2010  Martin Hauner
 *                          http://subcommander.tigris.org
 *
 * This file is part of Subcommander.
 *
 * Subcommander  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.
 *
 * Subcommander  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 Subcommander. If not, see <http://www.gnu.org/licenses/>.
 * ==========================================================================
 */

// sc
#include "config.h"
#include "AboutDialog.h" 
#include "Gui.h"
#include "version.out.h"
#include "Utility.h"

// qt
#include <QtGui/QLayout>
#include <QtGui/QLabel>
#include <QtGui/QPixmap>
#include <QtGui/QPushButton>
#include <QtGui/QTextEdit>

// svn
#include <svn_version.h>

// apr
#include <apr_version.h>
#include <apu_version.h>
#ifdef _WIN32
#include <api_version.h>
#endif

#include <openssl/opensslv.h>

#ifdef SC_HAVE_BDB
// berkeley db
#include <db.h>

#define DB_VER_NUM STRINGIFY(DB_VERSION_MAJOR) \
               "." STRINGIFY(DB_VERSION_MINOR) \
               "." STRINGIFY(DB_VERSION_PATCH)
#endif // SC_HAVE_BDB

///////////////////////////////////////////////////////////////////////////////

QString getOpenSSLVersion()
{
  unsigned long openssl = OPENSSL_VERSION_NUMBER;

  // MNNFFPPS: major minor fix patch status
  int major  =  (openssl & 0xf0000000) >> 28;
  int minor  =  (openssl & 0x0ff00000) >> 20;
  int fix    =  (openssl & 0x000ff000) >> 12;
  int patch  = ((openssl & 0x00000ff0) >> 4) + 0x60;
  //int status =  (openssl & 0x0000000f);

  return QString("%1.%2.%3%4").arg(major).arg(minor).arg(fix).arg((char)patch);
}

///////////////////////////////////////////////////////////////////////////////

AboutDialog::AboutDialog( QWidget *parent )
: super(parent)
{
  QPixmap logo;
  QString sname;

  if( getLongAppName() == "subcommander" )
  {
    sname = _q("subcommander");

    setWindowTitle( _q("subcommander:about") );
    logo = QPixmap(":/LogoBanner_400x80_subcommander.png");
  }
  else
  {
    sname = _q("submerge");
    setWindowTitle( _q("submerge:about") );
    logo = QPixmap(":/LogoBanner_400x80_submerge.png");
  }

  QVBoxLayout *vbl = new QVBoxLayout(this/*,0,5*/);
  vbl->setMargin(3);
  {
    QLabel *lp = new QLabel(this);
    vbl->addWidget(lp,0);
    {
      lp->setPixmap(logo);
      lp->setFixedSize(logo.size());
    }

    QString about;
    about += sname + " " SUBCOMMANDER_VERSION "\n\n";
#ifdef SUBCOMMANDER_SPECIALBUILD
    about += SUBCOMMANDER_SPECIALBUILD_DESCRIPTION "\n\n";
#endif // SUBCOMMANDER_SPECIALBUILD
    about += _q("Copyright 2003-2010 Martin Hauner");
    about += "\n";
    about += "http://subcommander.tigris.org" "\n\n";
    about += _q("for feedback or questions write to""\n"
             "dev@subcommander.tigris.org");

    QLabel *l = new QLabel(this);
    vbl->addWidget(l,0);
    l->setMargin(10);
    l->setText( about );
    l->setWordWrap(true);
    l->setAlignment( Qt::AlignCenter );
    l->setFrameStyle( QFrame::Box | QFrame::Sunken );
    l->setTextInteractionFlags( Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse );
    l->setSizePolicy( QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed) );

    QString about2 = 
      "<qt>";

    QString gnu = "<center><img src=\"";
    gnu += getIconDir() + "GNU.png";
    gnu += "\"></center>";

    about2 +=
       "<table border=0 width=100% cellspacing=5 cellpadding=0>"
        "<tr bgcolor=#1B0A72>"
         "<td align=center><font color=#ffffff>";
    about2 += _q("License");
    about2 += "<font></td>"
        "</tr>"
        "<tr>"
        " <td>";

    about2 += gnu +
        " </td>"
        "</tr>"
        "<tr>"
         "<td>"
          "<p align=center>";
    about2 += _q(
            "Subcommander 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.");
    about2 += 
          "</p>"
          "<p align=center>";
    about2 += _q(
            "You should have received a copy of the GNU General Public License along "
            "with Subcommander; if not, write to the Free Software Foundation, Inc., "
            "59 Temple Place  - Suite 330, Boston, MA  02111-1307, USA.");
    about2 +=
          "</p>"
          "<p align=center>";
    about2 += _q(
            "Subcommander 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.");
    about2 +=
          "</p>"
          "<p align=center>";
    about2 += _q(
            "In  addition,  as  a  special  exception,  the  copyright holder  gives "
            "permission  to link the code  of this program  with the  Qt library (or "
            "with  modified versions  of Qt that use the  same license as  Qt),  and "
            "distribute  linked combinations including the  two.  You  must obey the "
            "GNU General Public License   in all respects  for all of  the code used "
            "other than Qt. ");
    about2 +=
          "</p>"
         "</td>"
        "</tr>"
       "</table>";

       about2 +=
       "<table border=0 width=100% cellspacing=5 cellpadding=0>";
#if 0
        "<tr bgcolor=#1B0A72>"
        "<td align=center colspan=2><font color=#ffffff>" +sname+ "<font></td>"
        "</tr>"
        "<tr bgcolor=#1B0A72>"
        "<td align=center colspan=2><font color=#ffffff>Author<font></td>"
        "</tr>"
        //"<tr>""<td align=center colspan=2>"/*"written by"*/"</td>""</tr>"
        "<tr>""<td align=center colspan=2>Martin Hauner</td>""</tr>"
        //"<tr>""<td align=center colspan=2>"/*" * * * "*/"</td>""</tr>"
        // add contributors here..
        "<tr>""<td align=center colspan=2>with contributions from:</td>""</tr>"
        "<tr>""<td align=center colspan=2>any volunteers?</td>""</tr>"
        "<tr>"
         "<td align=right>name</td>""<td align=left>contributions</td>"
        "</tr>"
        "<tr>""<td align=center colspan=2> * * * </td>""</tr>"
#endif

        // my current understanding of the open source lincenses is that you 
        // do not have to include the "This product includes software developed by ..."
        // clause if you only use the api and do not copy any source from it to your
        // own project.

       about2 +=
        "<tr bgcolor=#1B0A72>"
        "<td align=center colspan=2><font color=#ffffff>";
       about2 += _q("Libraries");
       about2 += "<font></td>"
        "</tr>"
        "<tr>"
         "<td align=center colspan=2>";

       if( getLongAppName() == "subcommander" )
       {
         about2 += _q("subcommander is using the following libraries:");
       }
       else
       {
         about2 += _q("submerge is using the following libraries:");
       }

       about2 +=
         "</td>"
        "</tr>"
        "<tr><td align=center valign=bottom colspan=2> * * * </td></tr>"
        "<tr>"
         "<td align=right>" "Qt " QT_VERSION_STR  "</td>"
         "<td align=left >" "http://www.trolltech.com" "</td>"
        "</tr>"
        "<tr><td align=center valign=bottom colspan=2> * * * </td></tr>"
        "<tr>"
         "<td align=center colspan=2>"
          "This product includes software developed by<br>"
          "CollabNet (http://www.Collab.Net/):"
         "</td>"
        "</tr>"
        "<tr>"
         "<td align=right width=50%>" "subversion " SVN_VERSION       "</td>"
         "<td align=left  width=50%>" "http://subversion.tigris.org"  "</td>"
        "</tr>"
        "<tr><td align=center valign=bottom colspan=2> * * * </td></tr>";

    if( getLongAppName() == "subcommander" )
    {
#ifdef SC_HAVE_BDB

      about2 +=
        "<tr>"
         "<td align=right>" "Berkeley DB " DB_VER_NUM  "</td>"
         "<td align=left >" "http://www.sleepycat.com" "</td>"
        "</tr>"
        "<tr><td align=center valign=bottom colspan=2> * * * </td></tr>";

#endif // SC_HAVE_BDB
    }

    if( getLongAppName() == "subcommander" )
    {
      about2 += 
        "<tr>"
         "<td align=right>" "OpenSSL ";
      about2 += getOpenSSLVersion();
      about2 +=
         "</td>"
         "<td align=left >" "http://www.openssl.org" "</td>"
        "</tr>"
        "<tr><td align=center valign=bottom colspan=2> * * * </td></tr>";
    }

    about2 +=
        "<tr>"
          "<td align=right>" "apr " APR_VERSION_STRING       "</td>"
          "<td align=left >" "http://apr.apache.org"         "</td>"
        "</tr>"
        "<tr>"
         "<td align=right>" "apr-util " APU_VERSION_STRING  "</td>"
         "<td align=left >" "http://apr.apache.org"         "</td>"
        "</tr>"
#ifdef _WIN32
        "<tr>"
         "<td align=right>" "apr-iconv " API_VERSION_STRING "</td>"
         "<td align=left >" "http://apr.apache.org"         "</td>"
        "</tr>"
#endif
        "<tr><td align=center valign=bottom colspan=2> * * * </td></tr>";

    if( getLongAppName() == "subcommander" )
    {
#ifdef SC_HAVE_NEON
      about2 += 
        "<tr>"
         "<td align=right>";
      about2 += getNeonVersion();
      about2 +=
         "</td>"
         "<td align=left>" "http://www.webdav.org"  "</td>"
        "</tr>"
        "<tr><td align=center valign=bottom colspan=2> * * * </td></tr>";
#endif // SC_HAVE_NEON

#ifdef SC_HAVE_SERF
      about2 +=
        "<tr>"
         "<td align=right>" "serf ";
      about2 += getSerfVersion();
      about2 +=
         "</td>"
         "<td align=left>" "http://code.google.com/p/serf" "</td>"
        "</tr>"
        "<tr><td align=center valign=bottom colspan=2> * * * </td></tr>";
#endif // SC_HAVE_SERF
    }


    about2 +=
        "<tr>"
          "<td align=right>";
    about2 += _q("nuvola (and crystal) icons");
    about2 +=
          "</td>"
          "<td align=left>" "http://www.kdelook.org"  "</td>"
        "</tr>"
        "<tr><td align=center valign=bottom colspan=2> * * * </td></tr>";

    about2 +=
       "</table><br>"
      "</qt>";

    QTextEdit* qtv = new QTextEdit(this);
    vbl->addWidget(qtv,3);
    qtv->setText( about2 );
    qtv->setLineWidth(1);
    qtv->setReadOnly(true);
    qtv->setFrameStyle( QFrame::Box | QFrame::Sunken );
    qtv->viewport()->setBackgroundRole( QPalette::Window );
    qtv->setSizePolicy( QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding) );
    qtv->setMinimumHeight( (int)(2.5 * lp->height()) );

    setFixedWidth( 406 /* 2*margin + logo width */ );
  }

  QHBoxLayout* hu = new QHBoxLayout;
  vbl->addLayout(hu);
  {
    QPushButton *b = new QPushButton(this);
    b->setDefault(true);
    b->setFocus();
    hu->addWidget(b);
    b->setText(qtf8(_("&Ok")));
    
    hu->addSpacing(getSizeGripSpacing());
    
    QObject::connect( b, SIGNAL(released()), this, SLOT(accept()) );
  }
}

AboutDialog::~AboutDialog()
{
}