31 { 96, 96, QT_TRANSLATE_NOOP(
"DPI_Chooser",
"Standard (96 x 96)") },
33 { 179, 185, QT_TRANSLATE_NOOP(
"DPI_Chooser",
"Greenphone (179 x 185)") },
35 { 192, 192, QT_TRANSLATE_NOOP(
"DPI_Chooser",
"High (192 x 192)") }
53 m_predefinedCombo(
new QComboBox),
54 m_dpiXSpinBox(
new QSpinBox),
55 m_dpiYSpinBox(
new QSpinBox)
58 DeviceProfile::systemResolution(&(m_systemEntry->dpiX), &(m_systemEntry->dpiY));
60 const struct DPI_Entry *systemEntry = m_systemEntry;
62 m_predefinedCombo->addItem(tr(
"System (%1 x %2)").arg(m_systemEntry
->dpiX).arg(m_systemEntry
->dpiY), QVariant::fromValue(systemEntry));
64 for (
const DPI_Entry &e : dpiEntries) {
65 if (e.dpiX != m_systemEntry->dpiX || e.dpiY != m_systemEntry->dpiY)
66 m_predefinedCombo->addItem(tr(e.description), QVariant::fromValue(&e));
68 m_predefinedCombo->addItem(tr(
"User defined"));
70 setFocusProxy(m_predefinedCombo);
71 m_predefinedCombo->setEditable(
false);
72 m_predefinedCombo->setCurrentIndex(0);
73 connect(m_predefinedCombo, &QComboBox::currentIndexChanged,
74 this, &DPI_Chooser::syncSpinBoxes);
76 QVBoxLayout *vBoxLayout =
new QVBoxLayout;
77 vBoxLayout->setContentsMargins(QMargins());
78 vBoxLayout->addWidget(m_predefinedCombo);
80 QHBoxLayout *hBoxLayout =
new QHBoxLayout;
81 hBoxLayout->setContentsMargins(QMargins());
83 m_dpiXSpinBox->setMinimum(
minDPI);
84 m_dpiXSpinBox->setMaximum(
maxDPI);
85 hBoxLayout->addWidget(m_dpiXSpinBox);
87 hBoxLayout->addWidget(
new QLabel(tr(
" x ")));
89 m_dpiYSpinBox->setMinimum(
minDPI);
90 m_dpiYSpinBox->setMaximum(
maxDPI);
91 hBoxLayout->addWidget(m_dpiYSpinBox);
93 hBoxLayout->addStretch();
94 vBoxLayout->addLayout(hBoxLayout);
95 setLayout(vBoxLayout);
116 m_predefinedCombo->setCurrentIndex(0);
120 const int count = m_predefinedCombo->count();
121 int predefinedIndex = -1;
122 for (
int i = 0; i < count; i++) {
123 const QVariant data = m_predefinedCombo->itemData(i);
124 if (data.metaType().id() != QMetaType::UnknownType) {
132 if (predefinedIndex != -1) {
133 m_predefinedCombo->setCurrentIndex(predefinedIndex);
135 setUserDefinedValues(dpiX, dpiY);