22 #include "ui_vp1eventdisplayeditor.h"
32 #include <QCloseEvent>
33 #include <QFileDialog>
44 Ui::VP1EventDisplayEditorForm
ui;
146 : QWidget(0), m_d(
new Imp)
156 m_d->
ui.setupUi(
this);
164 m_scene =
new QGraphicsScene();
165 m_scene->setSceneRect(QRectF(0.0, 0.0, 4000., 2641.));
175 QSplitter *previewSplitter =
new QSplitter;
176 previewSplitter->setOrientation(Qt::Vertical);
179 QSplitter *viewSplitter =
new QSplitter;
180 viewSplitter->setOrientation(Qt::Horizontal);
183 QSplitter *toolsSplitter =
new QSplitter;
184 toolsSplitter->setOrientation(Qt::Vertical);
187 QSplitter *mainSplitter =
new QSplitter;
188 mainSplitter->setOrientation(Qt::Horizontal);
191 previewSplitter->addWidget(
m_d->
ui.groupBox_objectList);
193 previewSplitter->addWidget(
m_d->
ui.groupBox_actions);
196 QWidget *containerPreview =
new QWidget;
197 QVBoxLayout *containerPreview_layout =
new QVBoxLayout;
199 containerPreview_layout->addWidget(previewSplitter);
200 containerPreview->setLayout(containerPreview_layout);
202 viewSplitter->addWidget(
view);
203 viewSplitter->addWidget(containerPreview);
205 QWidget *containerAllViews =
new QWidget;
206 QHBoxLayout *containerAllViews_layout =
new QHBoxLayout;
207 containerAllViews_layout->addWidget(viewSplitter);
208 containerAllViews->setLayout(containerAllViews_layout);
211 toolsSplitter->addWidget(
m_d->
ui.groupBox_getTab);
212 toolsSplitter->addWidget(
m_d->
ui.groupBox_bkg);
213 toolsSplitter->addWidget(
m_d->
ui.groupBox_logo);
214 toolsSplitter->addWidget(
m_d->
ui.groupBox_labels);
216 QWidget *containerTools =
new QWidget;
217 QVBoxLayout *containerTools_layout =
new QVBoxLayout;
218 containerTools_layout->addWidget(toolsSplitter);
219 containerTools_layout->addStretch(1);
220 containerTools->setLayout(containerTools_layout);
224 mainSplitter->addWidget(containerAllViews);
226 QGridLayout* grid =
static_cast<QGridLayout*
>(this->layout());
227 grid->addWidget(containerTools);
228 grid->addWidget(mainSplitter);
271 setWindowIcon(QIcon(QString(
":/vp1/icons/icons/3d_32x32.png")));
293 this->setWindowTitle(tr(
"ATLAS VP1 Event Display Editor"));
364 m_d->
ui.lineEdit_customLabelText->setEnabled(
false);
366 m_d->
ui.lineEdit_customLabelText->setEnabled(
true);
399 QString
fileName = QFileDialog::getSaveFileName(
this, tr(
"Save File"),
401 tr(
"Images (*.png *.jpg)"));
403 QImage
image(
m_scene->sceneRect().size().toSize(), QImage::Format_ARGB32);
404 image.fill(Qt::transparent);
406 QPainter painter(&
image);
407 painter.setRenderHint(QPainter::Antialiasing);
428 if (!
list.isEmpty()) {
429 for (QPixmap img :
list) {
431 QGraphicsPixmapItem*
item =
m_scene->addPixmap(img);
432 item->setFlags(QGraphicsItem::ItemIsMovable);
437 if (!listNames.isEmpty()) {
438 for (QString
name : listNames) {
440 new QListWidgetItem(
name,
m_d->
ui.listWidget);
449 QListWidgetItem * currentItem =
m_d->
ui.listWidget->currentItem();
450 QString
text = currentItem->text();
451 int currentPos =
m_d->
ui.listWidget->row( currentItem );
458 QListWidgetItem *
item =
m_d->
ui.listWidget->takeItem(currentPos);
504 if (
m_d->
ui.radioButton_eventDetails->isChecked()) {
510 text =
m_d->
ui.lineEdit_customLabelText->text();
516 if (
m_d->
ui.radioButton_size12->isChecked())
size = 12;
517 else if (
m_d->
ui.radioButton_size24->isChecked())
size = 24;
518 else if (
m_d->
ui.radioButton_size32->isChecked())
size = 32;
519 else if (
m_d->
ui.radioButton_size44->isChecked())
size = 44;
520 else if (
m_d->
ui.radioButton_sizeCustom->isChecked()) {
524 QString typeface =
"Courier";
526 int weight = QFont::Normal;
527 if (
m_d->
ui.radioButton_light->isChecked())
weight = QFont::Light;
528 else if (
m_d->
ui.radioButton_normal->isChecked())
weight = QFont::Normal;
529 else if (
m_d->
ui.radioButton_bold->isChecked())
weight = QFont::Bold;
530 else if (
m_d->
ui.radioButton_black_2->isChecked())
weight = QFont::Black;
532 bool italics =
false;
533 if (
m_d->
ui.radioButton_italics->isChecked()) italics =
true;
537 if (
m_d->
ui.radioButton_monaco->isChecked()) {
539 typeface =
"Courier";
540 font.setStyleHint(QFont::TypeWriter);
542 else if (
m_d->
ui.radioButton_helvetica->isChecked()) {
543 typeface =
"Helvetica";
544 font.setStyleHint(QFont::SansSerif);
546 else if (
m_d->
ui.radioButton_times->isChecked()) {
548 font.setStyleHint(QFont::Serif);
550 font.setFamily(typeface);
563 item->setFlags(QGraphicsItem::ItemIsMovable);
573 if (
m_d->
ui.radioButton_whiteText->isChecked()) {
574 item->setDefaultTextColor(Qt::white);
575 }
else if (
m_d->
ui.radioButton_blackText->isChecked()) {
576 item->setDefaultTextColor(Qt::black);
580 QString strippedText =
text.replace(
'\n',
' ').replace(
'\t',
' ').simplified();
581 new QListWidgetItem(strippedText,
m_d->
ui.listWidget);
591 int tabN =
m_d->
ui.comboBox_tabNumber->currentIndex();
592 QString tabName =
m_d->
ui.comboBox_tabNumber->currentText();
595 int imageWidth =
m_d->
ui.spinBox_imageWidth->value();
603 QList<QPixmap> listPixmap;
604 QStringList listNamesPixmap;
607 listNamesPixmap << tabName;
618 m_d->
ui.comboBox_tabNumber->addItems(listNames);
630 if (
m_d->
ui.radioButton_300px->isChecked() ) {
631 if (
m_d->
ui.radioButton_logo_white->isChecked() )
632 pix.load(
":/vp1/images/images/ATLAS-Logo-New_300pixels.png");
633 if (
m_d->
ui.radioButton_logo_main->isChecked() )
634 pix.load(
":/vp1/images/images/ATLAS-Logo-Ref-RGB-transpBkg-300px.png");
637 else if (
m_d->
ui.radioButton_450px->isChecked() ) {
638 if (
m_d->
ui.radioButton_logo_white->isChecked() )
639 pix.load(
":/vp1/images/images/ATLAS-Logo-New_450pixels.png");
640 if (
m_d->
ui.radioButton_logo_main->isChecked() )
641 pix.load(
":/vp1/images/images/ATLAS-Logo-Ref-RGB-transpBkg-450px.png");
644 else if (
m_d->
ui.radioButton_600px->isChecked() ) {
645 if (
m_d->
ui.radioButton_logo_white->isChecked() )
646 pix.load(
":/vp1/images/images/ATLAS-Logo-New_600pixels.png");
647 if (
m_d->
ui.radioButton_logo_main->isChecked() )
648 pix.load(
":/vp1/images/images/ATLAS-Logo-Ref-RGB-transpBkg-600px.png");
651 else if (
m_d->
ui.radioButton_800px->isChecked() ) {
652 if (
m_d->
ui.radioButton_logo_white->isChecked() )
653 pix.load(
":/vp1/images/images/ATLAS-Logo-New_800pixels.png");
654 if (
m_d->
ui.radioButton_logo_main->isChecked() )
655 pix.load(
":/vp1/images/images/ATLAS-Logo-Ref-RGB-transpBkg-800px.png");
658 else if (
m_d->
ui.radioButton_1000px->isChecked() ) {
659 if (
m_d->
ui.radioButton_logo_white->isChecked() )
660 pix.load(
":/vp1/images/images/ATLAS-Logo-New_1000pixels.png");
661 if (
m_d->
ui.radioButton_logo_main->isChecked() )
662 pix.load(
":/vp1/images/images/ATLAS-Logo-Ref-RGB-transpBkg-1000px.png");
663 name =
"logo_1000px";
665 else if (
m_d->
ui.radioButton_1200px->isChecked() ) {
666 if (
m_d->
ui.radioButton_logo_white->isChecked() )
667 pix.load(
":/vp1/images/images/ATLAS-Logo-New_1200pixels.png");
668 if (
m_d->
ui.radioButton_logo_main->isChecked() )
669 pix.load(
":/vp1/images/images/ATLAS-Logo-Ref-RGB-transpBkg-1200px.png");
670 name =
"logo_1200px";
675 item->setFlags(QGraphicsItem::ItemIsMovable);
679 new QListWidgetItem(
name,
m_d->
ui.listWidget);
688 if (
m_d->
ui.radioButton_white->isChecked() )
689 m_scene->setBackgroundBrush(Qt::white);
691 else if (
m_d->
ui.radioButton_black->isChecked() )
692 m_scene->setBackgroundBrush(Qt::black);
694 else if (
m_d->
ui.radioButton_transparent->isChecked() ) {
695 m_scene->setBackgroundBrush(Qt::NoBrush);