Back to index

scribus-ng  1.3.4.dfsg+svn20071115
imageinfodialog.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 "imageinfodialog.h"
00008 #include "imageinfodialog.moc"
00009 #include "commonstrings.h"
00010 
00011 extern QPixmap loadIcon(QString nam);
00012 
00013 ImageInfoDialog::ImageInfoDialog( QWidget* parent, ImageInfoRecord *info  ) : QDialog( parent, "ImageInfo", true, 0 )
00014 {
00015        setCaption( tr( "Image Info" ) );
00016        setIcon(loadIcon("AppIcon.png"));
00017 
00018        ImageInfoDialogLayout = new QVBoxLayout( this, 10, 5, "InsertTableLayout");
00019        GenGroup = new QGroupBox(this, "GenGroup");
00020        GenGroup->setTitle( tr("General Info"));
00021        GenGroup->setColumnLayout(0, Qt::Vertical);
00022        GenGroup->layout()->setSpacing(5);
00023        GenGroup->layout()->setMargin(5);
00024        layout3 = new QGridLayout(GenGroup->layout());
00025        Text0g = new QLabel( tr( "Date / Time:" ), GenGroup, "Text0g" );
00026        layout3->addWidget( Text0g, 0, 0 );
00027        timeInfo = new QLabel( info->exifInfo.dateTime, GenGroup, "timeInfo" );
00028        layout3->addWidget( timeInfo, 0, 1 );
00029        Text1g = new QLabel( tr( "Has Embedded Profile:" ), GenGroup, "Text1g" );
00030        layout3->addWidget( Text1g, 1, 0 );
00031        emProfile = new QLabel( "", GenGroup, "emProfile" );
00032        layout3->addWidget( emProfile, 1, 1 );
00033        if (info->isEmbedded)
00034               emProfile->setText(CommonStrings::trYes);
00035        else
00036               emProfile->setText(CommonStrings::trNo);
00037        Text2g = new QLabel( tr( "Profile Name:" ), GenGroup, "Text2g" );
00038        layout3->addWidget( Text2g, 2, 0 );
00039        emProfileN = new QLabel( info->profileName, GenGroup, "emProfileN" );
00040        layout3->addWidget( emProfileN, 2, 1 );
00041        Text3g = new QLabel( tr( "Has Embedded Paths:" ), GenGroup, "Text3g" );
00042        layout3->addWidget( Text3g, 3, 0 );
00043        emPath = new QLabel( "", GenGroup, "emPath" );
00044        layout3->addWidget( emPath, 3, 1 );
00045        if (info->PDSpathData.count() != 0)
00046               emPath->setText(CommonStrings::trYes);
00047        else
00048               emPath->setText(CommonStrings::trNo);
00049        Text4g = new QLabel( tr( "Has Layers:" ), GenGroup, "Text3g" );
00050        layout3->addWidget( Text4g, 4, 0 );
00051        emLayer = new QLabel( "", GenGroup, "emLayer" );
00052        layout3->addWidget( emLayer, 4, 1 );
00053        if (info->layerInfo.count() != 0)
00054               emLayer->setText(CommonStrings::trYes);
00055        else
00056               emLayer->setText(CommonStrings::trNo);
00057        ImageInfoDialogLayout->addWidget(GenGroup);
00058 
00059        ExGroup = new QGroupBox(this, "ExGroup");
00060        ExGroup->setTitle( tr("EXIF Info"));
00061        ExGroup->setColumnLayout(0, Qt::Vertical);
00062        ExGroup->layout()->setSpacing(5);
00063        ExGroup->layout()->setMargin(5);
00064        layout2 = new QGridLayout(ExGroup->layout());
00065        Text1 = new QLabel( "", ExGroup, "Text1" );
00066        layout2->addWidget( Text1, 0, 0 );
00067        Comment = new QLabel(info->exifInfo.comment, ExGroup, "Comment" );
00068        layout2->addWidget( Comment, 0, 1 );
00069        Text4 = new QLabel( "", ExGroup, "Text4" );
00070        layout2->addWidget( Text4, 1, 0 );
00071        UserComment = new QLabel(info->exifInfo.userComment, ExGroup, "UserComment" );
00072        layout2->addWidget( UserComment, 1, 1 );
00073        int a = 2;
00074        if (info->type == 1)
00075        {
00076               Text5 = new QLabel( tr("Artist:"), ExGroup, "Text5" );
00077               layout2->addWidget( Text5, 2, 0 );
00078               Artist = new QLabel(info->exifInfo.artist, ExGroup, "Artist" );
00079               layout2->addWidget( Artist, 2, 1 );
00080               a = 3;
00081        }
00082        Text2 = new QLabel( "", ExGroup, "Text2" );
00083        layout2->addWidget( Text2, a, 0 );
00084        Model = new QLabel(info->exifInfo.cameraName, ExGroup, "Model" );
00085        layout2->addWidget( Model, a, 1 );
00086        Text3 = new QLabel( "", ExGroup, "Text3" );
00087        layout2->addWidget( Text3, a+1, 0 );
00088        Manufact = new QLabel(info->exifInfo.cameraVendor, ExGroup, "Manufact" );
00089        layout2->addWidget( Manufact, a+1, 1 );
00090 
00091        Text6 = new QLabel( "", ExGroup, "Text6" );
00092        layout2->addWidget( Text6, a+2, 0 );
00093        QString tag = "";
00094        if (info->exifInfo.ExposureTime != 0)
00095        {
00096               float exposureTime = info->exifInfo.ExposureTime;
00097               tag = QString().sprintf("%6.3f", exposureTime);
00098               if ((exposureTime > 0.0) && (exposureTime <= 0.5))
00099                      tag += QString().sprintf(" (1/%d)", (int)(0.5 + 1/exposureTime) );
00100        }
00101        if (info->type == 0)
00102        {
00103               ExposureTime = new QLabel(tag, ExGroup, "ExposureTime" );
00104               layout2->addWidget( ExposureTime, a+2, 1 );
00105               Text7 = new QLabel( "", ExGroup, "Text7" );
00106               layout2->addWidget( Text7, a+3, 0 );
00107               ApertureFNumber = new QLabel(QString().sprintf("f/%3.1f", info->exifInfo.ApertureFNumber), ExGroup, "ApertureFNumber" );
00108               layout2->addWidget( ApertureFNumber, a+3, 1 );
00109               Text8 = new QLabel( "", ExGroup, "Text8" );
00110               layout2->addWidget( Text8, a+4, 0 );
00111               ISOequivalent = new QLabel(QString().sprintf("%2d", info->exifInfo.ISOequivalent), ExGroup, "ISOequivalent" );
00112               layout2->addWidget( ISOequivalent, a+4, 1 );
00113        }
00114        ImageInfoDialogLayout->addWidget(ExGroup);
00115        switch (info->type)
00116        {
00117               case 0:
00118                      Text1->setText( tr( "Comment:" ));
00119                      Text4->setText( tr( "User Comment:" ));
00120                      Text2->setText( tr( "Camera Model:" ));
00121                      Text3->setText( tr( "Camera Manufacturer:" ));
00122                      Text6->setText( tr( "Exposure time" ));
00123                      Text7->setText( tr( "Aperture:" ));
00124                      Text8->setText( tr( "ISO equiv.:" ));
00125                      break;
00126               case 1:
00127                      Text1->setText( tr( "Description:" ));
00128                      Text4->setText( tr( "Copyright:" ));
00129                      Text2->setText( tr( "Scanner Model:" ));
00130                      Text3->setText( tr( "Scanner Manufacturer:" ));
00131                      break;
00132               default:
00133                      ExGroup->hide();
00134                      break;
00135        }
00136        layout1 = new QHBoxLayout( 0, 0, 5, "layout1");
00137        QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00138        layout1->addItem( spacer );
00139        okButton = new QPushButton( CommonStrings::tr_OK, this, "okButton" );
00140        okButton->setDefault( true );
00141        layout1->addWidget( okButton );
00142        ImageInfoDialogLayout->addLayout( layout1 );
00143        resize(minimumSizeHint());
00144 
00145        // signals and slots connections
00146        connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
00147 }