1 #include "../ApplicationController.h" 2 #include "../events/MapEvents.h" 3 #include "../events/ApplicationEvents.h" 5 #include "../../widgets/canvas/MapDisplay.h" 6 #include "../../widgets/Utils.h" 8 #include "../../widgets/layer/explorer/LayerItemView.h" 10 #include "ui_DisplayWidgetForm.h" 15 #include <QColorDialog> 18 #include <QIntValidator> 19 #include <QApplication> 20 #include <QDesktopWidget> 24 #include <boost/lexical_cast.hpp> 28 m_ui(new
Ui::DisplayWidgetForm)
34 QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
35 QString hexColor = sett.value(
"display/defaultDisplayColor").toString();
37 dColor.setNamedColor(hexColor);
39 QPalette palette =
m_ui->m_backColor->palette();
43 palette.setColor(QPalette::Window, Qt::white);
47 palette.setColor(QPalette::Window, dColor);
50 m_ui->m_backColor->setPalette(palette);
51 m_ui->m_backColor->setAutoFillBackground(
true);
53 QIntValidator* validatorWidth =
new QIntValidator(
this);
54 m_ui->m_screenWidthLineEdit->setValidator(validatorWidth);
56 QIntValidator* validatorHeight =
new QIntValidator(
this);
57 m_ui->m_screenHeightLineEdit->setValidator(validatorHeight);
73 QColor color = QColorDialog::getColor(
m_ui->m_backColor->palette().color(QPalette::Window),
this);
78 QPalette palette =
m_ui->m_backColor->palette();
79 palette.setColor(QPalette::Window, color);
80 m_ui->m_backColor->setPalette(palette);
81 m_ui->m_backColor->setAutoFillBackground(
true);
89 QString widthMMStr =
m_ui->m_screenWidthLineEdit->text();
90 QString heightMMStr =
m_ui->m_screenHeightLineEdit->text();
92 if(widthMMStr.isEmpty() || heightMMStr.isEmpty())
94 QMessageBox::warning(
this,
95 tr(
"Display Options"),
96 tr(
"Fill width and height!"));
100 int widthMM = widthMMStr.toInt();
101 int heightMM = heightMMStr.toInt();
103 QRect screenRect = QApplication::desktop()->screenGeometry();
104 int width = screenRect.width();
105 int height = screenRect.height();
107 int dpiX = (double)width/((
double)widthMM/25.4);
108 int dpiY = (double)height/((
double)heightMM/25.4);
116 if(mapDisplay ==
nullptr)
118 QMessageBox::warning(
this,
119 tr(
"Display Options"),
120 tr(
"Map Display Configuration Failed!"));
130 std::list<te::map::AbstractLayerPtr> ls;
141 QMessageBox::information(
this,
142 tr(
"Display Options"),
143 tr(
"Screen Size Configuration Applied!"));
149 QString widthMMStr =
m_ui->m_screenWidthLineEdit->text();
150 QString heightMMStr =
m_ui->m_screenHeightLineEdit->text();
152 if(widthMMStr.isEmpty() && heightMMStr.isEmpty())
163 if(mapDisplay ==
nullptr)
165 QMessageBox::warning(
this,
166 tr(
"Display Options"),
167 tr(
"Map Display Configuration Failed!"));
177 std::list<te::map::AbstractLayerPtr> ls;
181 m_ui->m_screenWidthLineEdit->clear();
182 m_ui->m_screenHeightLineEdit->clear();
187 QMessageBox::information(
this,
188 tr(
"Display Options"),
189 tr(
"Default Screen Size Restored!"));
200 QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
202 sett.setValue(
"display/defaultDisplayColor",
m_ui->m_backColor->palette().color(QPalette::Window).name());
213 QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
215 sett.setValue(
"display/screenWidthMM",
m_ui->m_screenWidthLineEdit->text());
216 sett.setValue(
"display/screenHeightMM",
m_ui->m_screenHeightLineEdit->text());
221 QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
222 QString hexColor = sett.value(
"display/defaultDisplayColor").toString();
224 dColor.setNamedColor(hexColor);
226 QPalette palette =
m_ui->m_backColor->palette();
228 if(!dColor.isValid())
230 palette.setColor(QPalette::Window, Qt::white);
234 palette.setColor(QPalette::Window, dColor);
237 m_ui->m_backColor->setPalette(palette);
238 m_ui->m_backColor->setAutoFillBackground(
true);
243 QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
245 QString widthMM = sett.value(
"display/screenWidthMM").toString();
246 QString heightMM = sett.value(
"display/screenHeightMM").toString();
248 m_ui->m_screenWidthLineEdit->setText(widthMM);
249 m_ui->m_screenHeightLineEdit->setText(heightMM);
259 ns =
"dpi.inpe.br.apf";
260 helpFile =
"apf/settings/display/DisplayConfig.html";
void fit(const std::list< te::map::AbstractLayerPtr > &layers)
te::qt::widgets::MapDisplay * getDisplay()
te::qt::widgets::LayerItemView * m_layerExplorer
This event signals that the color of the map display changed.
This event can be used to retrieve the MapDisplat component.
void trigger(te::qt::af::evt::Event *)
te::qt::af::MapDisplay * m_display