Merge pull request #1612 from jasleenkaur/Line_Number

added line number option on editor preferences
This commit is contained in:
Marius Kintel 2016-03-31 11:55:27 -04:00
commit 9caee5b80a
6 changed files with 65 additions and 13 deletions

View file

@ -561,6 +561,11 @@ void Preferences::on_checkBoxEnableBraceMatching_toggled(bool val)
Settings::Settings::inst()->set(Settings::Settings::enableBraceMatching, Value(val));
writeSettings();
}
void Preferences::on_checkBoxEnableLineNumbers_toggled(bool checked)
{
Settings::Settings::inst()->set(Settings::Settings::enableLineNumbers, Value(checked));
writeSettings();
}
void Preferences::writeSettings()
{
@ -684,6 +689,7 @@ void Preferences::updateGUI()
this->checkBoxHighlightCurrentLine->setChecked(s->get(Settings::Settings::highlightCurrentLine).toBool());
this->checkBoxEnableBraceMatching->setChecked(s->get(Settings::Settings::enableBraceMatching).toBool());
this->checkBoxShowWarningsIn3dView->setChecked(s->get(Settings::Settings::showWarningsIn3dView).toBool());
this->checkBoxEnableLineNumbers->setChecked(s->get(Settings::Settings::enableLineNumbers).toBool());
}
void Preferences::initComboBox(QComboBox *comboBox, const Settings::SettingsEntry& entry)

View file

@ -70,6 +70,7 @@ public slots:
// Display
void on_checkBoxHighlightCurrentLine_toggled(bool);
void on_checkBoxEnableBraceMatching_toggled(bool);
void on_checkBoxEnableLineNumbers_toggled(bool);
signals:
void requestRedraw() const;

View file

@ -31,7 +31,16 @@
</property>
<widget class="QWidget" name="page3DView">
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@ -95,7 +104,16 @@
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@ -107,9 +125,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>634</width>
<height>662</height>
<y>-262</y>
<width>639</width>
<height>653</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_5">
@ -226,7 +244,7 @@
<widget class="QFontComboBox" name="fontChooser">
<property name="currentFont">
<font>
<family>Helvetica</family>
<family>TeX Gyre Heros</family>
<pointsize>12</pointsize>
</font>
</property>
@ -680,6 +698,13 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBoxEnableLineNumbers">
<property name="text">
<string>Display Line Numbers</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -1126,7 +1151,16 @@
</widget>
<widget class="QWidget" name="pageFeatures">
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
@ -1163,8 +1197,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>36</height>
<width>82</width>
<height>26</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">
@ -1198,7 +1232,16 @@
</widget>
<widget class="QWidget" name="pageAdvanced">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@ -1217,8 +1260,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>440</width>
<height>339</height>
<width>490</width>
<height>383</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_12">

View file

@ -180,6 +180,7 @@ void ScintillaEditor::applySettings()
qsci->setBraceMatching(s->get(Settings::Settings::enableBraceMatching).toBool() ? QsciScintilla::SloppyBraceMatch : QsciScintilla::NoBraceMatch);
qsci->setCaretLineVisible(s->get(Settings::Settings::highlightCurrentLine).toBool());
qsci->setMarginLineNumbers(1,s->get(Settings::Settings::enableLineNumbers).toBool());
}
void ScintillaEditor::setPlainText(const QString &text)

View file

@ -141,5 +141,5 @@ SettingsEntry Settings::indentStyle("editor", "indentStyle", values("Spaces", _(
SettingsEntry Settings::tabKeyFunction("editor", "tabKeyFunction", values("Indent", _("Indent"), "InsertTab", _("Insert Tab")), Value("Indent"));
SettingsEntry Settings::highlightCurrentLine("editor", "highlightCurrentLine", Value(true), Value(true));
SettingsEntry Settings::enableBraceMatching("editor", "enableBraceMatching", Value(true), Value(true));
SettingsEntry Settings::enableLineNumbers("editor", "enableLineNumbers", Value(true), Value(true));
}

View file

@ -50,6 +50,7 @@ public:
static SettingsEntry tabKeyFunction;
static SettingsEntry highlightCurrentLine;
static SettingsEntry enableBraceMatching;
static SettingsEntry enableLineNumbers;
static Settings *inst(bool erase = false);