Commit f8f5d1de authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

const'ify + add missing Q_REQUIRED_RESULT

parent 79034b40
Pipeline #151313 passed with stages
in 6 minutes and 34 seconds
......@@ -97,7 +97,7 @@ public:
KPIMTextEdit::RichTextExternalComposer *externalComposer() const;
KPIMTextEdit::RichTextComposerActions *composerActions() const;
void createHighlighter() override;
virtual bool processModifyText(QKeyEvent *event);
Q_REQUIRED_RESULT virtual bool processModifyText(QKeyEvent *event);
public Q_SLOTS:
void insertPlainTextImplementation();
......
......@@ -28,7 +28,7 @@ public:
Q_REQUIRED_RESULT int rowCount(const QModelIndex &parent = QModelIndex()) const override;
Q_REQUIRED_RESULT QVariant data(const QModelIndex &index, int role) const override;
const QVector<EmoticonUnicodeUtils::EmoticonStruct> &emoticonList() const;
Q_REQUIRED_RESULT const QVector<EmoticonUnicodeUtils::EmoticonStruct> &emoticonList() const;
void setEmoticonList(const QVector<EmoticonUnicodeUtils::EmoticonStruct> &newEmoticonList);
private:
......
......@@ -20,7 +20,7 @@ public:
void setCategories(EmoticonUnicodeUtils::EmoticonStruct::EmoticonType newCategories);
protected:
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
Q_REQUIRED_RESULT bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
private:
EmoticonUnicodeUtils::EmoticonStruct::EmoticonType mCategories = EmoticonUnicodeUtils::EmoticonStruct::Unknown;
......
......@@ -21,6 +21,8 @@ using namespace KPIMTextEdit;
TextEditFindBarBase::TextEditFindBarBase(QWidget *parent)
: QWidget(parent)
, mFindWidget(new TextFindWidget(this))
, mReplaceWidget(new TextReplaceWidget(this))
{
auto topLayout = new QVBoxLayout(this);
auto lay = new QHBoxLayout;
......@@ -38,10 +40,8 @@ TextEditFindBarBase::TextEditFindBarBase(QWidget *parent)
closeBtn->setAutoRaise(true);
lay->addWidget(closeBtn);
mFindWidget = new TextFindWidget(this);
lay->addWidget(mFindWidget);
mReplaceWidget = new TextReplaceWidget(this);
topLayout->addWidget(mReplaceWidget);
mReplaceWidget->hide();
......
......@@ -77,8 +77,8 @@ private Q_SLOTS:
protected:
QString mLastSearchStr;
QRegularExpression mLastSearchRegExp;
TextFindWidget *mFindWidget = nullptr;
TextReplaceWidget *mReplaceWidget = nullptr;
TextFindWidget *const mFindWidget;
TextReplaceWidget *const mReplaceWidget;
bool mHideWhenClose = true;
};
}
......
......@@ -61,6 +61,8 @@ void TextReplaceWidget::slotSearchStringEmpty(bool isEmpty)
TextFindWidget::TextFindWidget(QWidget *parent)
: QWidget(parent)
, mSearch(new QLineEdit(this))
, mFindPrevBtn(new QPushButton(QIcon::fromTheme(QStringLiteral("go-up-search")), i18nc("Find and go to the previous search match", "Previous"), this))
, mFindNextBtn(new QPushButton(QIcon::fromTheme(QStringLiteral("go-down-search")), i18nc("Find and go to the next search match", "Next"), this))
{
auto lay = new QHBoxLayout(this);
const int marg1 = lay->contentsMargins().left();
......@@ -75,13 +77,11 @@ TextFindWidget::TextFindWidget(QWidget *parent)
label->setBuddy(mSearch);
lay->addWidget(mSearch);
mFindNextBtn = new QPushButton(QIcon::fromTheme(QStringLiteral("go-down-search")), i18nc("Find and go to the next search match", "Next"), this);
mFindNextBtn->setToolTip(i18n("Jump to next match"));
lay->addWidget(mFindNextBtn);
mFindNextBtn->setEnabled(false);
mFindNextBtn->setObjectName(QStringLiteral("mFindNextBtn"));
mFindPrevBtn = new QPushButton(QIcon::fromTheme(QStringLiteral("go-up-search")), i18nc("Find and go to the previous search match", "Previous"), this);
mFindPrevBtn->setToolTip(i18n("Jump to previous match"));
lay->addWidget(mFindPrevBtn);
mFindPrevBtn->setEnabled(false);
......
......@@ -53,8 +53,8 @@ private:
QAction *mRegularExpressionAct = nullptr;
QAction *mRespectDiacriticAct = nullptr;
QPushButton *mFindPrevBtn = nullptr;
QPushButton *mFindNextBtn = nullptr;
QPushButton *const mFindPrevBtn;
QPushButton *const mFindNextBtn;
};
class KPIMTEXTEDIT_TESTS_EXPORT TextReplaceWidget : public QWidget
......
......@@ -24,7 +24,12 @@ class TextMessageIndicator : public QWidget
public:
explicit TextMessageIndicator(QWidget *parent = nullptr);
enum Icon { None, Info, Warning, Error };
enum Icon {
None,
Info,
Warning,
Error,
};
void display(const QString &message, const QString &details = QString(), Icon icon = None, int durationMs = 4000);
......
......@@ -27,7 +27,12 @@ public:
Q_REQUIRED_RESULT bool isReady() const;
enum State { Ready = 0, Speaking, Paused, BackendError };
enum State {
Ready = 0,
Speaking,
Paused,
BackendError,
};
Q_REQUIRED_RESULT double volume() const;
Q_REQUIRED_RESULT QVector<QLocale> availableLocales() const;
......
......@@ -20,7 +20,10 @@
using namespace KPIMTextEdit;
TextToSpeechConfigWidget::TextToSpeechConfigWidget(QWidget *parent)
: QWidget(parent)
, mLanguage(new KPIMTextEdit::TextToSpeechLanguageComboBox(this))
, mAbstractTextToSpeechConfigInterface(new TextToSpeechConfigInterface(this))
, mAvailableEngine(new QComboBox(this))
, mVoice(new QComboBox(this))
{
auto layout = new QFormLayout(this);
mVolume = new QSlider(this);
......@@ -48,19 +51,16 @@ TextToSpeechConfigWidget::TextToSpeechConfigWidget(QWidget *parent)
mPitch->setOrientation(Qt::Horizontal);
layout->addRow(i18n("Pitch:"), mPitch);
mAvailableEngine = new QComboBox(this);
mAvailableEngine->setObjectName(QStringLiteral("engine"));
layout->addRow(i18n("Engine:"), mAvailableEngine);
connect(mAvailableEngine, &QComboBox::currentIndexChanged, this, &TextToSpeechConfigWidget::slotEngineChanged);
connect(mAvailableEngine, &QComboBox::currentIndexChanged, this, &TextToSpeechConfigWidget::valueChanged);
mLanguage = new KPIMTextEdit::TextToSpeechLanguageComboBox(this);
mLanguage->setObjectName(QStringLiteral("language"));
layout->addRow(i18n("Language:"), mLanguage);
connect(mAvailableEngine, &QComboBox::currentIndexChanged, this, &TextToSpeechConfigWidget::slotLanguageChanged);
connect(mLanguage, &QComboBox::currentIndexChanged, this, &TextToSpeechConfigWidget::valueChanged);
mVoice = new QComboBox(this);
mVoice->setObjectName(QStringLiteral("voice"));
layout->addRow(i18n("Voice:"), mVoice);
connect(mVoice, &QComboBox::currentIndexChanged, this, &TextToSpeechConfigWidget::valueChanged);
......
......@@ -43,10 +43,10 @@ private:
QSlider *mVolume = nullptr;
QSlider *mRate = nullptr;
QSlider *mPitch = nullptr;
TextToSpeechLanguageComboBox *mLanguage = nullptr;
TextToSpeechLanguageComboBox *const mLanguage;
AbstractTextToSpeechConfigInterface *mAbstractTextToSpeechConfigInterface = nullptr;
QComboBox *mAvailableEngine = nullptr;
QComboBox *mVoice = nullptr;
QComboBox *const mAvailableEngine;
QComboBox *const mVoice;
};
}
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