Skip to content

Commit 92a799e

Browse files
committed
Refine desktop controls and hover help
1 parent 412b788 commit 92a799e

4 files changed

Lines changed: 318 additions & 45 deletions

File tree

src/detectCradleDialog.cpp

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ QLabel#dialogHint {
6565
color: %5;
6666
}
6767
68+
QRadioButton {
69+
spacing: 8px;
70+
}
71+
72+
QRadioButton::indicator {
73+
width: 14px;
74+
height: 14px;
75+
}
76+
6877
QSpinBox {
6978
min-width: 68px;
7079
padding: 3px 8px;
@@ -73,18 +82,30 @@ QSpinBox {
7382
background: %1;
7483
}
7584
85+
QSpinBox:focus {
86+
border-color: %7;
87+
}
88+
7689
QPushButton {
77-
min-width: 104px;
78-
padding: 5px 14px;
90+
min-width: 96px;
91+
padding: 4px 12px;
7992
border: 1px solid %3;
8093
border-radius: 9px;
8194
background: transparent;
8295
}
8396
97+
QPushButton:hover {
98+
background: %6;
99+
}
100+
84101
QPushButton[role="primary"] {
85102
background: %6;
86103
border-color: %7;
87104
}
105+
106+
QPushButton[role="primary"]:hover {
107+
background: %7;
108+
}
88109
)")
89110
.arg(cssColor(window),
90111
cssColor(sectionFill),
@@ -95,6 +116,18 @@ QPushButton[role="primary"] {
95116
cssColor(highlight));
96117
}
97118

119+
void applyHelpText(QWidget *widget,
120+
const QString &toolTip,
121+
const QString &statusTip,
122+
const QString &accessibleName = QString())
123+
{
124+
widget->setToolTip(toolTip);
125+
widget->setStatusTip(statusTip);
126+
widget->setWhatsThis(statusTip);
127+
widget->setAccessibleName(accessibleName.isEmpty() ? toolTip : accessibleName);
128+
widget->setAccessibleDescription(statusTip);
129+
}
130+
98131
void applyMacCompactSize(QWidget *widget)
99132
{
100133
#if defined(Q_OS_MACOS)
@@ -132,6 +165,7 @@ DetectCradleDialog::DetectCradleDialog(QWidget *parent) : QDialog(parent)
132165
setWindowTitle(tr("Detect Cradle"));
133166
setModal(true);
134167
setMinimumWidth(420);
168+
setAttribute(Qt::WA_AlwaysShowToolTips);
135169
setStyleSheet(dialogStyleSheet(palette()));
136170

137171
QVBoxLayout *layout = new QVBoxLayout(this);
@@ -145,6 +179,12 @@ DetectCradleDialog::DetectCradleDialog(QWidget *parent) : QDialog(parent)
145179
m_assisted = new QRadioButton(tr("Assisted Detect"));
146180
applyMacCompactSize(m_auto);
147181
applyMacCompactSize(m_assisted);
182+
applyHelpText(m_auto,
183+
tr("Auto detect cradle members"),
184+
tr("Let Platypus estimate the number of horizontal and vertical cradle members automatically."));
185+
applyHelpText(m_assisted,
186+
tr("Assisted detect cradle members"),
187+
tr("Provide approximate horizontal and vertical member counts to guide cradle detection."));
148188
modeLayout->addWidget(m_auto);
149189
modeLayout->addWidget(m_assisted);
150190

@@ -171,6 +211,12 @@ DetectCradleDialog::DetectCradleDialog(QWidget *parent) : QDialog(parent)
171211
m_v->setRange(1, 50);
172212
m_h->setAlignment(Qt::AlignRight);
173213
m_v->setAlignment(Qt::AlignRight);
214+
applyHelpText(m_h,
215+
tr("Horizontal member count"),
216+
tr("Approximate number of horizontal cradle members expected in the image."));
217+
applyHelpText(m_v,
218+
tr("Vertical member count"),
219+
tr("Approximate number of vertical cradle members expected in the image."));
174220

175221
QGridLayout *grid = new QGridLayout;
176222
grid->setContentsMargins(0, 0, 0, 0);
@@ -194,6 +240,12 @@ DetectCradleDialog::DetectCradleDialog(QWidget *parent) : QDialog(parent)
194240
buttons->button(QDialogButtonBox::Ok)->setProperty("role", "primary");
195241
applyMacCompactSize(buttons->button(QDialogButtonBox::Ok));
196242
applyMacCompactSize(buttons->button(QDialogButtonBox::Cancel));
243+
applyHelpText(buttons->button(QDialogButtonBox::Ok),
244+
tr("Run cradle detection"),
245+
tr("Run cradle detection using the selected mode and guide counts."));
246+
applyHelpText(buttons->button(QDialogButtonBox::Cancel),
247+
tr("Cancel detection"),
248+
tr("Close the dialog without changing the current cradle marks."));
197249

198250
QSettings settings;
199251
int h = settings.value(kKey_Horizontal, 5).toInt();

0 commit comments

Comments
 (0)