Back to index

scribus-ng  1.3.4.dfsg+svn20071115
docinfo.cpp
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #include <qlabel.h>
00008 #include <qlayout.h>
00009 #include <qlineedit.h>
00010 #include <qmultilineedit.h>
00011 
00012 #include "docinfo.h"
00013 #include "docinfo.moc"
00014 
00015 extern QPixmap loadIcon(QString nam);
00016 
00017 #include <qtooltip.h>
00018 #include "documentinformation.h"
00019 /*
00020  *  Constructs a DocInfos which is a child of 'parent', with the
00021  *  name 'name' and widget flags set to 'f'
00022  *
00023  *  The dialog will by default be modeless, unless you set 'modal' to
00024  *  TRUE to construct a modal dialog.
00025  */
00026 DocInfos::DocInfos( QWidget* parent, DocumentInformation& docInfo )
00027               : QTabWidget( parent, 0, 0 )
00028 {
00029        infos = docInfo;
00030        setMaximumSize( QSize( 32767, 32767 ) );
00031        setCaption( tr( "Document Information" ) );
00032        setIcon(loadIcon("AppIcon.png"));
00033 
00034        page1 = new QWidget( this );
00035        layout1 = new QGridLayout(page1);
00036        layout1->setSpacing( 6 );
00037        layout1->setMargin( 5 );
00038 
00039        titleEdit = new QLineEdit( page1, "titleEdit" );
00040        titleLabel = new QLabel( titleEdit, tr("&Title:") , page1, "titleLabel");
00041        titleLabel->resize( titleLabel->sizeHint() );
00042        layout1->addWidget( titleLabel, 0, 0 );
00043        layout1->addWidget( titleEdit, 0, 1 );
00044 
00045        authorEdit = new QLineEdit( page1, "lineEditAuthor" );
00046        authorLabel = new QLabel( authorEdit, tr("&Author:"), page1, "authorLabel" );
00047        authorLabel->resize( authorLabel->sizeHint() );
00048        layout1->addWidget( authorLabel, 1, 0 );
00049        layout1->addWidget( authorEdit, 1, 1 );
00050 
00051        keywordsEdit = new QMultiLineEdit( page1, "keywordsEdit" );
00052        keywordsLabel = new QLabel( keywordsEdit, tr("&Keywords:"), page1, "keywordsLabel" );
00053        keywordsLabel->setAlignment( static_cast<int>( QLabel::AlignTop | QLabel::AlignLeft ) );
00054        keywordsEdit->setMinimumSize(QSize(200, 105));
00055        layout1->addWidget( keywordsLabel, 2, 0 );
00056        layout1->addWidget( keywordsEdit, 2, 1 );
00057 
00058        descriptionEdit = new QMultiLineEdit( page1, "descriptionEdit" );
00059        descriptionLabel = new QLabel( descriptionEdit, tr("Descri&ption:"), page1, "descriptionLabel" );
00060        descriptionLabel->setAlignment( static_cast<int>( QLabel::AlignTop | QLabel::AlignLeft ) );
00061        descriptionEdit->setMinimumSize(QSize(200, 105));
00062        layout1->addWidget( descriptionLabel, 3, 0 );
00063        layout1->addWidget( descriptionEdit, 3, 1 );
00064 
00065        page2 = new QWidget( this );
00066        layout2 = new QGridLayout(page2);
00067        layout2->setSpacing( 6 );
00068        layout2->setMargin( 5 );
00069 
00070        publisherEdit = new QLineEdit( page2, "publisherEdit" );
00071        publisherLabel = new QLabel( publisherEdit, tr("P&ublisher:") , page2, "publisherLabel");
00072        publisherLabel->resize( publisherLabel->sizeHint() );
00073        layout2->addWidget( publisherLabel, 0, 0 );
00074        layout2->addWidget( publisherEdit, 0, 1 );
00075 
00076        contributorsEdit = new QMultiLineEdit( page2, "contributorsEdit" );
00077        contributorsLabel = new QLabel( contributorsEdit, tr("&Contributors:"), page2, "contributorsLabel" );
00078        contributorsLabel->setAlignment( static_cast<int>( QLabel::AlignTop | QLabel::AlignLeft ) );
00079        contributorsEdit->setMinimumSize(QSize(200, 105));
00080        layout2->addWidget( contributorsLabel, 1, 0 );
00081        layout2->addWidget( contributorsEdit, 1, 1 );
00082 
00083        dateEdit = new QLineEdit( page2, "dateEdit" );
00084        dateLabel = new QLabel( dateEdit, tr("Dat&e:") , page2, "dateLabel");
00085        dateLabel->resize( dateLabel->sizeHint() );
00086        layout2->addWidget( dateLabel, 2, 0 );
00087        layout2->addWidget( dateEdit, 2, 1 );
00088 
00089        typeEdit = new QLineEdit( page2, "typeEdit" );
00090        typeLabel = new QLabel( typeEdit, tr("T&ype:") , page2, "typeLabel");
00091        typeLabel->resize( typeLabel->sizeHint() );
00092        layout2->addWidget( typeLabel, 3, 0 );
00093        layout2->addWidget( typeEdit, 3, 1 );
00094 
00095        formatEdit = new QLineEdit( page2, "formatEdit" );
00096        formatLabel = new QLabel( formatEdit, tr("F&ormat:") , page2, "formatLabel");
00097        formatLabel->resize( formatLabel->sizeHint() );
00098        layout2->addWidget( formatLabel, 4, 0 );
00099        layout2->addWidget( formatEdit, 4, 1 );
00100 
00101        identifierEdit = new QLineEdit( page2, "identifierEdit" );
00102        identifierLabel = new QLabel( identifierEdit, tr("Identi&fier:") , page2, "identifierLabel");
00103        identifierLabel->resize( identifierLabel->sizeHint() );
00104        layout2->addWidget( identifierLabel, 5, 0 );
00105        layout2->addWidget( identifierEdit, 5, 1 );
00106 
00107        sourceEdit = new QLineEdit( page2, "sourceEdit" );
00108        sourceLabel = new QLabel( sourceEdit, tr("&Source:") , page2, "sourceLabel");
00109        sourceLabel->resize( sourceLabel->sizeHint() );
00110        layout2->addWidget( sourceLabel, 6, 0 );
00111        layout2->addWidget( sourceEdit, 6, 1 );
00112 
00113        languageEdit = new QLineEdit( page2, "languageEdit" );
00114        languageLabel = new QLabel( languageEdit, tr("&Language:") , page2, "languageLabel");
00115        languageLabel->resize( languageLabel->sizeHint() );
00116        layout2->addWidget( languageLabel, 7, 0 );
00117        layout2->addWidget( languageEdit, 7, 1 );
00118 
00119        relationEdit = new QLineEdit( page2, "relationEdit" );
00120        relationLabel = new QLabel( relationEdit, tr("&Relation:") , page2, "relationLabel");
00121        relationLabel->resize( relationLabel->sizeHint() );
00122        layout2->addWidget( relationLabel, 8, 0 );
00123        layout2->addWidget( relationEdit, 8, 1 );
00124 
00125        coverageEdit = new QLineEdit( page2, "coverageEdit" );
00126        coverageLabel = new QLabel( coverageEdit, tr("Co&verage:") , page2, "coverageLabel");
00127        coverageLabel->resize( coverageLabel->sizeHint() );
00128        layout2->addWidget( coverageLabel, 9, 0 );
00129        layout2->addWidget( coverageEdit, 9, 1 );
00130 
00131        rightsEdit = new QLineEdit( page2, "rightsEdit" );
00132        rightsLabel = new QLabel( rightsEdit, tr("Ri&ghts:") , page2, "rightsLabel");
00133        rightsLabel->resize( rightsLabel->sizeHint() );
00134        layout2->addWidget( rightsLabel, 10, 0 );
00135        layout2->addWidget( rightsEdit, 10, 1 );
00136 
00137 
00138        addTab( page1, tr("Documen&t") );
00139        addTab( page2, tr("Further &Information") );
00140 
00141        // switched off as it's called in main prefs classes - PV
00142        //restoreDefaults();
00143 
00144        //tooltips
00145        QToolTip::add( authorEdit, "<qt>" + tr( "The person or organisation primarily responsible for making the content of the document. This field can be embedded in the Scribus document for reference, as well as in the metadata of a PDF" ) );
00146        QToolTip::add( titleEdit, "<qt>" + tr( "A name given to the document. This field can be embedded in the Scribus document for reference, as well as in the metadata of a PDF" ) + "</qt>");
00147        QToolTip::add( descriptionEdit, "<qt>" + tr( "An account of the content of the document. This field is for a brief description or abstract of the document. It is embedded in the PDF on export" ) + "</qt>" );
00148        QToolTip::add( keywordsEdit, "<qt>" + tr( "The topic of the content of the document. This field is for document keywords you wish to embed in a PDF, to assist searches and indexing of PDF files" ) + "</qt>" );
00149        QToolTip::add( publisherEdit, "<qt>" + tr( "A person or organisation responsible for making the document available" ) + "</qt>" );
00150        QToolTip::add( contributorsEdit, "<qt>" + tr( "A person or organisation responsible for making contributions to the content of the document" ) + "</qt>" );
00151        QToolTip::add( dateEdit, "<qt>" + tr( "A date associated with an event in the life cycle of the document, in YYYY-MM-DD format, as per ISO 8601" ) + "</qt>" );
00152        QToolTip::add( typeEdit, "<qt>" + tr( "The nature or genre of the content of the document, eg. categories, functions, genres, etc" )  + "</qt>");
00153        QToolTip::add( formatEdit, "<qt>" + tr( "The physical or digital manifestation of the document. Media type and dimensions would be worth noting. RFC2045,RFC2046 for MIME types are also useful here" ) + "</qt>" );
00154        QToolTip::add( identifierEdit, "<qt>" + tr( "An unambiguous reference to the document within a given context such as ISBN or URI" ) + "</qt>" );
00155        QToolTip::add( sourceEdit, "<qt>" + tr( "A reference to a document from which the present document is derived, eg. ISBN or URI" ) + "</qt>" );
00156        QToolTip::add( languageEdit, "<qt>" + tr( "The language in which the content of the document is written, usually a ISO-639 language code optionally suffixed with a hypen and an ISO-3166 country code, eg. en-GB, fr-CH" ) + "</qt>" );
00157        QToolTip::add( relationEdit, "<qt>" + tr( "A reference to a related document, possibly using a formal identifier such as a ISBN or URI" ) + "</qt>" );
00158        QToolTip::add( coverageEdit, "<qt>" + tr( "The extent or scope of the content of the document, possibly including location, time and jurisdiction ranges" ) + "</qt>" );
00159        QToolTip::add( rightsEdit, "<qt>" + tr( "Information about rights held in and over the document, eg. copyright, patent or trademark" ) + "</qt>" );
00160 }
00161 
00162 
00163 DocumentInformation DocInfos::getDocInfo()
00164 {
00165        DocumentInformation docInfo;
00166        docInfo.setAuthor(authorEdit->text());
00167        docInfo.setComments(descriptionEdit->text());
00168        docInfo.setContrib(contributorsEdit->text());
00169        docInfo.setCover(coverageEdit->text());
00170        docInfo.setDate(dateEdit->text());
00171        docInfo.setFormat(formatEdit->text());
00172        docInfo.setIdent(identifierEdit->text());
00173        docInfo.setKeywords(keywordsEdit->text());
00174        docInfo.setLangInfo(languageEdit->text());
00175        docInfo.setPublisher(publisherEdit->text());
00176        docInfo.setRelation(relationEdit->text());
00177        docInfo.setRights(rightsEdit->text());
00178        docInfo.setSource(sourceEdit->text());
00179        docInfo.setTitle(titleEdit->text());
00180        docInfo.setType(typeEdit->text());
00181        return docInfo;
00182 }
00183 
00184 void DocInfos::restoreDefaults()
00185 {
00186        titleEdit->setText(infos.getTitle());
00187        authorEdit->setText(infos.getAuthor());
00188        descriptionEdit->setText(infos.getComments());
00189        keywordsEdit->setText(infos.getKeywords());
00190        publisherEdit->setText(infos.getPublisher());
00191        dateEdit->setText(infos.getDate());
00192        typeEdit->setText(infos.getType());
00193        formatEdit->setText(infos.getFormat());
00194        identifierEdit->setText(infos.getIdent());
00195        sourceEdit->setText(infos.getSource());
00196        languageEdit->setText(infos.getLangInfo());
00197        relationEdit->setText(infos.getRelation());
00198        coverageEdit->setText(infos.getCover());
00199        rightsEdit->setText(infos.getRights());
00200        contributorsEdit->setText(infos.getContrib());
00201 }