[be54f4]: src / gui / aboutwindow.cc  Maximize  Restore  History

Download this file

129 lines (110 with data), 4.4 kB

  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
/*
* PDFedit - free program for PDF document manipulation.
* Copyright (C) 2006, 2007, 2008 PDFedit team: Michal Hocko,
* Miroslav Jahoda,
* Jozef Misutka,
* Martin Petricek
*
* This program 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; version 2 of the License.
*
* This program 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 this program (in doc/LICENSE.GPL); if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Project is hosted on http://sourceforge.net/projects/pdfedit
*/
/** @file
AboutWindow - class representing about window.
Display authors, application name and version.
@author Martin Petricek
*/
#include "aboutwindow.h"
#include "version.h"
#include "util.h"
#include "iconcache.h"
#include "imagewidget.h"
#include <qframe.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qsaglobal.h>
#include <qsizepolicy.h>
namespace gui {
using namespace std;
/** Version of program */
QString app=QString(APP_NAME) +" "+ QString(PDFEDIT_VERSION);
/** About Dialog flags */
const Qt::WFlags aboutDialogFlags=Qt::WDestructiveClose | Qt::WType_Dialog;
/**
constructor of AboutWindow, creates window and fills it with elements, parameters are ignored
@param parent Parent window of this dialog
@param name Name of this window (used only for debugging
*/
AboutWindow::AboutWindow(QWidget *parent/*=0*/,const char *name/*=0*/):QWidget(parent,name,aboutDialogFlags) {
ic=new IconCache();
//Window title
setCaption(app+" - "+tr("About program"));
QGridLayout *l=new QGridLayout(this,2,2);
l->setRowStretch(0,1);
//Text in about window
QString info=QString("<big><b>")+tr("Free program for PDF document manipulation")+"</b></big><br><br>"
+tr("Homepage")+" : http://pdfedit.petricek.net/<br>"
+tr("Project page")+" : http://sourceforge.net/projects/pdfedit";
QString authors=QString("<b>Copyright (C) 2006, 2007, 2008 PDFedit team:</b><br>")
+QString::fromUtf8("&nbsp; Michal Hocko<br>&nbsp; Miro Jahoda<br>&nbsp; Jozef Mi��utka<br>&nbsp; Martin Pet������ek<br>");
QLabel *lb=new QLabel(QString("<table><tr><td valign=\"top\"><h1>")+app+"</h1>"+tr("Compiled")+": "+COMPILE_TIME
+"<br>"+tr("Using Qt %1").arg(QT_VERSION_STR)
+tr(", QSA %1").arg(QSA_VERSION_STRING)
+"<br><br>"+info+"<br><br>"+authors+"</td></tr><tr><td colspan=\"\2\">"+tr("This program is distributed under terms of GNU GPL")+"</td></tr></table>", this);
lb->setTextFormat(Qt::RichText);
//Lower frame with Ok button
QFrame *okFrame=new QFrame(this);
QGridLayout *lFrame=new QGridLayout(okFrame,1,2,5);
//Ok button
QPushButton *ok=new QPushButton(QObject::tr("&Ok"), okFrame);
lFrame->addWidget(ok,0,1);
QObject::connect(ok, SIGNAL(clicked()), this, SLOT(close()));
okFrame->setFixedHeight(10+ok->sizeHint().height());
//Image sizes
QSize imageSize;
QSize bgSize;
//Logo on right
QPixmap* logoImage=ic->getIcon("pdfedit_logo.png");
QWidget *logo=new ImageWidget(logoImage,QColor(255,255,255),this);
if (logoImage) {
imageSize=logoImage->size();
logo->setFixedWidth(imageSize.width());
}
//Background of text
QPixmap* bgImage=ic->getIcon("pdfedit_bg.png");
if (bgImage) {
lb->setErasePixmap(*bgImage);
bgSize=bgImage->size();
lb->setMaximumSize(bgSize);
}
//Set minumum/maximum sizes
if (bgImage!=NULL && logoImage!=NULL) {
// Two conditions should be met:
// Background must not repeat
// Logo must be shown completely
setMaximumSize(QSize(bgSize.width()+imageSize.width(),10+ok->sizeHint().height()+bgSize.height()));
setMinimumSize(QSize(imageSize.width(),10+ok->sizeHint().height()+imageSize.height()));
}
l->setResizeMode(QLayout::Minimum);
l->addWidget(lb,0,0);
l->addWidget(logo,0,1);
l->addMultiCellWidget(okFrame,1,1,0,1);
}
/** default destructor */
AboutWindow::~AboutWindow() {
delete ic;
}
} // namespace gui

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks