Commit 32418bbe authored by JanKusanagi's avatar JanKusanagi

Allow inserting symbols as H1 header

parent df34c7ba
......@@ -55,8 +55,14 @@ CharacterPicker::CharacterPicker(QWidget *parent) : QWidget(parent)
this, &CharacterPicker::onCodePointChanged); // FIXME TMP
m_makeBigCheckbox = new QCheckBox(tr("Insert in big size"), this);
m_makeBigCheckbox->setChecked(settings.value("CharacterPicker/bigSymbols")
.toBool());
m_mainLayout = new QVBoxLayout();
m_mainLayout->addWidget(m_charSelect);
m_mainLayout->addWidget(m_makeBigCheckbox);
this->setLayout(m_mainLayout);
......@@ -101,8 +107,19 @@ void CharacterPicker::onCodePointChanged(uint codepoint)
return;
}
emit characterSelected(QString("&#%1;").arg(codepoint));
qDebug() << "CharacterPicker, character selected:" << codepoint;
QString htmlToInsert = QString("&#%1;").arg(codepoint);
if (m_makeBigCheckbox->isChecked())
{
htmlToInsert.prepend(QStringLiteral("<h1>"));
htmlToInsert.append(QStringLiteral("</h1> "));
}
else
{
htmlToInsert.append(QStringLiteral(" "));
}
emit characterSelected(htmlToInsert);
qDebug() << "CharacterPicker::onCodePointChanged()" << codepoint;
this->close();
}
......@@ -118,6 +135,7 @@ void CharacterPicker::closeEvent(QCloseEvent *event)
QSettings settings;
settings.setValue("CharacterPicker/charPickerWindowSize", this->size());
settings.setValue("CharacterPicker/charPickerFontSize", m_fontSize);
settings.setValue("CharacterPicker/bigSymbols", m_makeBigCheckbox->isChecked());
this->deleteLater();
......
......@@ -25,6 +25,7 @@
#include <QVBoxLayout>
#include <KCharSelect>
#include <QPushButton>
#include <QCheckBox>
#include <QAction>
#include <QCloseEvent>
#include <QSettings>
......@@ -56,6 +57,9 @@ private:
QVBoxLayout *m_mainLayout;
KCharSelect *m_charSelect;
QCheckBox *m_makeBigCheckbox;
QVector<uint> m_displayedCodePoints;
int m_fontSize;
......
Markdown is supported
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