Commit ca9a1948 authored by David Jarvie's avatar David Jarvie
Browse files

Add tooltips

parent b64ccf88
Pipeline #73106 passed with stage
in 9 minutes and 58 seconds
......@@ -131,6 +131,7 @@ void AlarmTimeWidget::init(Mode mode, const QString& title)
timeBoxHLayout->addWidget(mAnyTimeCheckBox);
mAnyTimeCheckBox->setFixedSize(mAnyTimeCheckBox->sizeHint());
connect(mAnyTimeCheckBox, &CheckBox::toggled, this, &AlarmTimeWidget::slotAnyTimeToggled);
mAnyTimeCheckBox->setToolTip(i18nc("@info:tooltip", "Set only a date (without a time) for the alarm"));
mAnyTimeCheckBox->setWhatsThis(i18nc("@info:whatsthis",
"Check to specify only a date (without a time) for the alarm. The alarm will trigger at the first opportunity on the selected date."));
}
......@@ -180,6 +181,7 @@ void AlarmTimeWidget::init(Mode mode, const QString& title)
// Time zone selection push button
mTimeZoneButton = new PushButton(i18nc("@action:button", "Time Zone..."), topWidget);
connect(mTimeZoneButton, &PushButton::clicked, this, &AlarmTimeWidget::showTimeZoneSelector);
mTimeZoneButton->setToolTip(i18nc("@info:tooltip", "Choose a time zone for this alarm"));
mTimeZoneButton->setWhatsThis(i18nc("@info:whatsthis",
"Choose a time zone for this alarm which is different from the default time zone set in KAlarm's configuration dialog."));
grid->addWidget(mTimeZoneButton, 2, 2, 1, 2, Qt::AlignRight);
......
......@@ -1630,7 +1630,8 @@ void EditAudioAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
mTryButton->setWhatsThis(i18nc("@info:whatsthis", "Play the audio file now"));
mTryButton->setToolTip(i18nc("@info:tooltip", "Play the audio file now"));
// File name edit box
mSoundConfig = new SoundWidget(false, true, parent);
const QString repWhatsThis = i18nc("@info:whatsthis", "If checked, the sound file will be played repeatedly until %1 is clicked.", KAlarm::i18n_act_StopPlay());
mSoundConfig = new SoundWidget(false, repWhatsThis, parent);
if (isTemplate())
mSoundConfig->setAllowEmptyFile();
connect(mSoundConfig, &SoundWidget::changed, this, &EditAudioAlarmDlg::contentsChanged);
......
/*
* fontcolourbutton.cpp - pushbutton widget to select a font and colour
* Program: kalarm
* SPDX-FileCopyrightText: 2003-2020 David Jarvie <djarvie@kde.org>
* SPDX-FileCopyrightText: 2003-2021 David Jarvie <djarvie@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
......@@ -29,6 +29,7 @@ FontColourButton::FontColourButton(QWidget* parent)
: PushButton(i18nc("@action:button", "Font && Color..."), parent)
{
connect(this, &FontColourButton::clicked, this, &FontColourButton::slotButtonPressed);
setToolTip(i18nc("@info:tooltip", "Set alarm message font and color"));
setWhatsThis(i18nc("@info:whatsthis", "Choose the font, and foreground and background color, for the alarm message."));
}
......
......@@ -141,6 +141,10 @@ QString uidKOrganizer(const QString& eventID);
namespace KAlarm
{
// Collect these widget labels together to ensure consistent wording and
// translations across different modules.
QString i18n_act_StopPlay() { return i18nc("@action", "Stop Play"); }
Private* Private::mInstance = nullptr;
/******************************************************************************
......@@ -197,7 +201,7 @@ KToggleAction* createAlarmEnableAction(QObject* parent)
*/
QAction* createStopPlayAction(QObject* parent)
{
QAction* action = new QAction(QIcon::fromTheme(QStringLiteral("media-playback-stop")), i18nc("@action", "Stop Play"), parent);
QAction* action = new QAction(QIcon::fromTheme(QStringLiteral("media-playback-stop")), i18n_act_StopPlay(), parent);
action->setEnabled(MessageDisplay::isAudioPlaying());
QObject::connect(action, &QAction::triggered, theApp(), &KAlarmApp::stopAudio);
// The following line ensures that all instances are kept in the same state
......
......@@ -68,6 +68,8 @@ struct UpdateResult
void set(UpdateStatus s, const QString& m) { status = s; message = m; }
};
QString i18n_act_StopPlay(); // text of Stop Play action
/** Display a main window with the specified event selected */
MainWindow* displayMainWindowSelected(const QString& eventId);
......
......@@ -50,7 +50,8 @@ SoundDlg::SoundDlg(const QString& file, float volume, float fadeVolume, int fade
: QDialog(parent)
{
auto layout = new QVBoxLayout(this);
mSoundWidget = new SoundWidget(true, true, this);
const QString repWhatsThis = i18nc("@info:whatsthis", "If checked, the sound file will be played repeatedly for as long as the message is displayed.");
mSoundWidget = new SoundWidget(true, repWhatsThis, this);
layout->addWidget(mSoundWidget);
mButtonBox = new QDialogButtonBox;
......@@ -136,8 +137,9 @@ void SoundDlg::slotButtonClicked(QAbstractButton* button)
=============================================================================*/
QString SoundWidget::mDefaultDir;
SoundWidget::SoundWidget(bool showPlay, bool showRepeat, QWidget* parent)
SoundWidget::SoundWidget(bool showPlay, const QString& repeatWhatsThis, QWidget* parent)
: QWidget(parent)
, mRepeatWhatsThis(repeatWhatsThis)
{
auto layout = new QVBoxLayout(this);
......@@ -191,35 +193,32 @@ SoundWidget::SoundWidget(bool showPlay, bool showRepeat, QWidget* parent)
mFileBrowseButton->setFixedSize(size, size);
}
if (showRepeat)
{
// Sound repetition checkbox
mRepeatGroupBox = new GroupBox(i18n_chk_Repeat(), this);
mRepeatGroupBox->setCheckable(true);
mRepeatGroupBox->setWhatsThis(i18nc("@info:whatsthis", "If checked, the sound file will be played repeatedly for as long as the message is displayed."));
connect(mRepeatGroupBox, &GroupBox::toggled, this, &SoundWidget::changed);
layout->addWidget(mRepeatGroupBox);
auto glayout = new QVBoxLayout(mRepeatGroupBox);
// Pause between repetitions
QWidget* box = new QWidget(mRepeatGroupBox);
glayout->addWidget(box, 0, Qt::AlignLeft);
boxHLayout = new QHBoxLayout(box);
boxHLayout->setContentsMargins(0, 0, 0, 0);
label = new QLabel(i18nc("@label:spinbox Length of time to pause between repetitions", "Pause between repetitions:"), box);
boxHLayout->addWidget(label);
label->setFixedSize(label->sizeHint());
mRepeatPause = new SpinBox(0, 999, box);
boxHLayout->addWidget(mRepeatPause);
mRepeatPause->setSingleShiftStep(10);
mRepeatPause->setFixedSize(mRepeatPause->sizeHint());
label->setBuddy(mRepeatPause);
connect(mRepeatPause, &SpinBox::valueChanged, this, &SoundWidget::changed);
label = new QLabel(i18nc("@label", "seconds"), box);
boxHLayout->addWidget(label);
label->setFixedSize(label->sizeHint());
box->setWhatsThis(i18nc("@info:whatsthis", "Enter how many seconds to pause between repetitions."));
}
// Sound repetition checkbox
mRepeatGroupBox = new GroupBox(i18n_chk_Repeat(), this);
mRepeatGroupBox->setCheckable(true);
mRepeatGroupBox->setWhatsThis(mRepeatWhatsThis);
connect(mRepeatGroupBox, &GroupBox::toggled, this, &SoundWidget::changed);
layout->addWidget(mRepeatGroupBox);
auto glayout = new QVBoxLayout(mRepeatGroupBox);
// Pause between repetitions
box = new QWidget(mRepeatGroupBox);
glayout->addWidget(box, 0, Qt::AlignLeft);
boxHLayout = new QHBoxLayout(box);
boxHLayout->setContentsMargins(0, 0, 0, 0);
label = new QLabel(i18nc("@label:spinbox Length of time to pause between repetitions", "Pause between repetitions:"), box);
boxHLayout->addWidget(label);
label->setFixedSize(label->sizeHint());
mRepeatPause = new SpinBox(0, 999, box);
boxHLayout->addWidget(mRepeatPause);
mRepeatPause->setSingleShiftStep(10);
mRepeatPause->setFixedSize(mRepeatPause->sizeHint());
label->setBuddy(mRepeatPause);
connect(mRepeatPause, &SpinBox::valueChanged, this, &SoundWidget::changed);
label = new QLabel(i18nc("@label", "seconds"), box);
label->setFixedSize(label->sizeHint());
boxHLayout->addWidget(label);
box->setWhatsThis(i18nc("@info:whatsthis", "Enter how many seconds to pause between repetitions."));
// Volume
QGroupBox* group = new QGroupBox(i18nc("@title:group Sound volume", "Volume"), this);
......
......@@ -30,7 +30,7 @@ class SoundWidget : public QWidget
{
Q_OBJECT
public:
SoundWidget(bool showPlay, bool showRepeat, QWidget* parent);
SoundWidget(bool showPlay, const QString& repeatWhatsThis, QWidget* parent);
~SoundWidget() override;
void set(const QString& file, float volume, float fadeVolume = -1, int fadeSeconds = 0, int repeatPause = -1);
void setReadOnly(bool);
......@@ -62,6 +62,7 @@ private Q_SLOTS:
private:
static QString mDefaultDir; // current default directory for mFileEdit
const QString mRepeatWhatsThis;
QPushButton* mFilePlay {nullptr};
LineEdit* mFileEdit;
PushButton* mFileBrowseButton;
......
/*
* specialactions.cpp - widget to specify special alarm actions
* Program: kalarm
* SPDX-FileCopyrightText: 2004-2019 David Jarvie <djarvie@kde.org>
* SPDX-FileCopyrightText: 2004-2021 David Jarvie <djarvie@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
......@@ -39,6 +39,7 @@ SpecialActionsButton::SpecialActionsButton(bool enableCheckboxes, QWidget* paren
setCheckable(true);
setChecked(false);
connect(this, &SpecialActionsButton::clicked, this, &SpecialActionsButton::slotButtonPressed);
setToolTip(i18nc("@info:tooltip", "Set commands to execute"));
setWhatsThis(i18nc("@info:whatsthis", "Specify actions to execute before and after the alarm is displayed."));
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment