File: imageinfodialog.cpp

package info (click to toggle)
scribus 1.4.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 244,532 kB
  • sloc: cpp: 274,439; xml: 12,534; python: 3,448; ansic: 3,438; makefile: 1,201; perl: 95; sh: 41
file content (157 lines) | stat: -rw-r--r-- 5,462 bytes parent folder | download | duplicates (5)
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
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#include "imageinfodialog.h"

#include <QPixmap>
#include <QSpacerItem>
#include <QGridLayout>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QLabel>
#include <QGroupBox>
#include <QPushButton>
#include "commonstrings.h"
#include "util_icon.h"

ImageInfoDialog::ImageInfoDialog( QWidget* parent, ImageInfoRecord *info  ) : QDialog( parent )
{
	setModal(true);
	setWindowTitle( tr( "Image Info" ) );
	setWindowIcon(loadIcon("AppIcon.png"));

	ImageInfoDialogLayout = new QVBoxLayout( this );
	ImageInfoDialogLayout->setMargin(10);
	ImageInfoDialogLayout->setSpacing(5);
	GenGroup = new QGroupBox(this);
	GenGroup->setTitle( tr("General Info"));
	layout3 = new QGridLayout(GenGroup);
	layout3->setMargin(5);
	layout3->setSpacing(5);
	Text0g = new QLabel( tr( "Date / Time:" ), GenGroup);
	layout3->addWidget( Text0g, 0, 0 );
	timeInfo = new QLabel( info->exifInfo.dateTime, GenGroup);
	layout3->addWidget( timeInfo, 0, 1 );
	Text1g = new QLabel( tr( "Has Embedded Profile:" ), GenGroup);
	layout3->addWidget( Text1g, 1, 0 );
	emProfile = new QLabel( "", GenGroup);
	layout3->addWidget( emProfile, 1, 1 );
	if (info->isEmbedded)
		emProfile->setText(CommonStrings::trYes);
	else
		emProfile->setText(CommonStrings::trNo);
	Text2g = new QLabel( tr( "Profile Name:" ), GenGroup);
	layout3->addWidget( Text2g, 2, 0 );
	emProfileN = new QLabel( info->profileName, GenGroup);
	layout3->addWidget( emProfileN, 2, 1 );
	Text3g = new QLabel( tr( "Has Embedded Paths:" ), GenGroup);
	layout3->addWidget( Text3g, 3, 0 );
	emPath = new QLabel( "", GenGroup );
	layout3->addWidget( emPath, 3, 1 );
	if (info->PDSpathData.count() != 0)
		emPath->setText(CommonStrings::trYes);
	else
		emPath->setText(CommonStrings::trNo);
	Text4g = new QLabel( tr( "Has Layers:" ), GenGroup);
	layout3->addWidget( Text4g, 4, 0 );
	emLayer = new QLabel( "", GenGroup);
	layout3->addWidget( emLayer, 4, 1 );
	if (info->layerInfo.count() != 0)
		emLayer->setText(CommonStrings::trYes);
	else
		emLayer->setText(CommonStrings::trNo);
	ImageInfoDialogLayout->addWidget(GenGroup);

	ExGroup = new QGroupBox(this);
	ExGroup->setTitle( tr("EXIF Info"));
	layout2 = new QGridLayout(ExGroup);
	layout2->setMargin(5);
	layout2->setSpacing(5);
	Text1 = new QLabel( "", ExGroup);
	layout2->addWidget( Text1, 0, 0 );
	Comment = new QLabel(info->exifInfo.comment, ExGroup);
	layout2->addWidget( Comment, 0, 1 );
	Text4 = new QLabel( "", ExGroup);
	layout2->addWidget( Text4, 1, 0 );
	UserComment = new QLabel(info->exifInfo.userComment, ExGroup);
	layout2->addWidget( UserComment, 1, 1 );
	int a = 2;
	if (info->type == 1)
	{
		Text5 = new QLabel( tr("Artist:"), ExGroup);
		layout2->addWidget( Text5, 2, 0 );
		Artist = new QLabel(info->exifInfo.artist, ExGroup);
		layout2->addWidget( Artist, 2, 1 );
		a = 3;
	}
	Text2 = new QLabel( "", ExGroup);
	layout2->addWidget( Text2, a, 0 );
	Model = new QLabel(info->exifInfo.cameraName, ExGroup);
	layout2->addWidget( Model, a, 1 );
	Text3 = new QLabel( "", ExGroup);
	layout2->addWidget( Text3, a+1, 0 );
	Manufact = new QLabel(info->exifInfo.cameraVendor, ExGroup);
	layout2->addWidget( Manufact, a+1, 1 );

	Text6 = new QLabel( "", ExGroup);
	layout2->addWidget( Text6, a+2, 0 );
	QString tag = "";
	if (info->exifInfo.ExposureTime != 0)
	{
		float exposureTime = info->exifInfo.ExposureTime;
		tag = QString().sprintf("%6.3f", exposureTime);
		if ((exposureTime > 0.0) && (exposureTime <= 0.5))
			tag += QString().sprintf(" (1/%d)", (int)(0.5 + 1/exposureTime) );
	}
	if (info->type == 0)
	{
		ExposureTime = new QLabel(tag, ExGroup);
		layout2->addWidget( ExposureTime, a+2, 1 );
		Text7 = new QLabel( "", ExGroup);
		layout2->addWidget( Text7, a+3, 0 );
		ApertureFNumber = new QLabel(QString().sprintf("f/%3.1f", info->exifInfo.ApertureFNumber), ExGroup);
		layout2->addWidget( ApertureFNumber, a+3, 1 );
		Text8 = new QLabel( "", ExGroup);
		layout2->addWidget( Text8, a+4, 0 );
		ISOequivalent = new QLabel(QString().sprintf("%2d", info->exifInfo.ISOequivalent), ExGroup);
		layout2->addWidget( ISOequivalent, a+4, 1 );
	}
	ImageInfoDialogLayout->addWidget(ExGroup);
	switch (info->type)
	{
		case 0:
			Text1->setText( tr( "Comment:" ));
			Text4->setText( tr( "User Comment:" ));
			Text2->setText( tr( "Camera Model:" ));
			Text3->setText( tr( "Camera Manufacturer:" ));
			Text6->setText( tr( "Exposure time" ));
			Text7->setText( tr( "Aperture:" ));
			Text8->setText( tr( "ISO equiv.:" ));
			break;
		case 1:
			Text1->setText( tr( "Description:" ));
			Text4->setText( tr( "Copyright:" ));
			Text2->setText( tr( "Scanner Model:" ));
			Text3->setText( tr( "Scanner Manufacturer:" ));
			break;
		default:
			ExGroup->hide();
			break;
	}
	layout1 = new QHBoxLayout;
	layout1->setMargin(5);
	layout1->setSpacing(5);
	QSpacerItem* spacer = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum );
	layout1->addItem( spacer );
	okButton = new QPushButton( CommonStrings::tr_OK, this);
	okButton->setDefault( true );
	layout1->addWidget( okButton );
	ImageInfoDialogLayout->addLayout( layout1 );
	resize(minimumSizeHint());

	// signals and slots connections
	connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
}