30 { 96, 96, QT_TRANSLATE_NOOP(
"DPI_Chooser",
"Standard (96 x 96)") },
32 { 179, 185, QT_TRANSLATE_NOOP(
"DPI_Chooser",
"Greenphone (179 x 185)") },
34 { 192, 192, QT_TRANSLATE_NOOP(
"DPI_Chooser",
"High (192 x 192)") }
52 m_predefinedCombo(
new QComboBox),
53 m_dpiXSpinBox(
new QSpinBox),
54 m_dpiYSpinBox(
new QSpinBox)
57 DeviceProfile::systemResolution(&(m_systemEntry->dpiX), &(m_systemEntry->dpiY));
59 const struct DPI_Entry *systemEntry = m_systemEntry;
61 m_predefinedCombo->addItem(tr(
"System (%1 x %2)").arg(m_systemEntry->dpiX).arg(m_systemEntry->dpiY), QVariant::fromValue(systemEntry));
63 for (
const DPI_Entry &e : dpiEntries) {
64 if (e.dpiX != m_systemEntry->dpiX || e.dpiY != m_systemEntry->dpiY)
65 m_predefinedCombo->addItem(tr(e.description), QVariant::fromValue(&e));
67 m_predefinedCombo->addItem(tr(
"User defined"));
69 setFocusProxy(m_predefinedCombo);
70 m_predefinedCombo->setEditable(
false);
71 m_predefinedCombo->setCurrentIndex(0);
72 connect(m_predefinedCombo, &QComboBox::currentIndexChanged,
73 this, &DPI_Chooser::syncSpinBoxes);
75 QVBoxLayout *vBoxLayout =
new QVBoxLayout;
76 vBoxLayout->setContentsMargins(QMargins());
77 vBoxLayout->addWidget(m_predefinedCombo);
79 QHBoxLayout *hBoxLayout =
new QHBoxLayout;
80 hBoxLayout->setContentsMargins(QMargins());
82 m_dpiXSpinBox->setMinimum(
minDPI);
83 m_dpiXSpinBox->setMaximum(
maxDPI);
84 hBoxLayout->addWidget(m_dpiXSpinBox);
86 hBoxLayout->addWidget(
new QLabel(tr(
" x ")));
88 m_dpiYSpinBox->setMinimum(
minDPI);
89 m_dpiYSpinBox->setMaximum(
maxDPI);
90 hBoxLayout->addWidget(m_dpiYSpinBox);
92 hBoxLayout->addStretch();
93 vBoxLayout->addLayout(hBoxLayout);
94 setLayout(vBoxLayout);
115 m_predefinedCombo->setCurrentIndex(0);
119 const int count = m_predefinedCombo->count();
120 int predefinedIndex = -1;
121 for (
int i = 0; i < count; i++) {
122 const QVariant data = m_predefinedCombo->itemData(i);
123 if (data.metaType().id() != QMetaType::UnknownType) {
131 if (predefinedIndex != -1) {
132 m_predefinedCombo->setCurrentIndex(predefinedIndex);
134 setUserDefinedValues(dpiX, dpiY);