add back indent guide, misc tweaks
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,6 +3,7 @@
|
||||
|
||||
# IDE stuff
|
||||
CMakeLists.txt.user*
|
||||
.qtcreator/
|
||||
|
||||
# Clangd
|
||||
.cache/
|
||||
|
||||
@@ -37,6 +37,7 @@ QString LexerGroupActionMenu::displayName(const QString &lexerName)
|
||||
{"cmake", "CMake"},
|
||||
{"hypertext", "HTML"},
|
||||
{"xml", "XML"},
|
||||
{"yaml", "YAML"},
|
||||
{"json", "JSON"},
|
||||
{"css", "CSS"},
|
||||
{"powershell", "PowerShell"}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>tAB wIDTH</string>
|
||||
<string>Tab width</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -37,7 +37,7 @@
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>eDITOR fONT</string>
|
||||
<string>Editor font</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -47,7 +47,7 @@
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>eDITOR dARK tHEME</string>
|
||||
<string>Editor dark theme</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
4
main.cpp
4
main.cpp
@@ -26,9 +26,9 @@ int main(int argc, char *argv[])
|
||||
QString(),
|
||||
QStringLiteral("https://blumia.net"));
|
||||
aboutData.addComponent("Scintilla", "A free source code editing component.",
|
||||
"5.5.0", "https://scintilla.org/");
|
||||
"5.5.8", "https://scintilla.org/");
|
||||
aboutData.addComponent("Lexilla", "A library of lexers that can be used with Scintilla.",
|
||||
"5.3.2", "https://www.scintilla.org/Lexilla.html");
|
||||
"5.4.6", "https://www.scintilla.org/Lexilla.html");
|
||||
KAboutData::setApplicationData(aboutData);
|
||||
a.setWindowIcon(QIcon::fromTheme(QStringLiteral("accessories-text-editor")));
|
||||
|
||||
|
||||
@@ -174,9 +174,12 @@ void MainWindow::setupActions()
|
||||
QAction *toggleIndentGuideAction = new QAction(this);
|
||||
toggleIndentGuideAction->setText("Toggle Indent Guide");
|
||||
toggleIndentGuideAction->setIcon(QIcon::fromTheme(u"show-guides"_s));
|
||||
toggleIndentGuideAction->setCheckable(true);
|
||||
toggleIndentGuideAction->setChecked(m_indentGuidesEnabled);
|
||||
actionCollection()->addAction(u"toggle_indent_guide"_s, toggleIndentGuideAction);
|
||||
connect(toggleIndentGuideAction, &QAction::triggered, this, [this](){
|
||||
// m_editor->setIndentationGuides(!m_editor->indentationGuides());
|
||||
connect(toggleIndentGuideAction, &QAction::toggled, this, [this](bool checked){
|
||||
m_indentGuidesEnabled = checked;
|
||||
applySettingsToAllEditors();
|
||||
});
|
||||
|
||||
QAction *toggleEditorDarkThemeAction = new QAction(this);
|
||||
@@ -235,6 +238,7 @@ void MainWindow::applyLexer(const QString &lexerName)
|
||||
void MainWindow::newFile()
|
||||
{
|
||||
m_tabWidget->newDocument();
|
||||
updateActions();
|
||||
}
|
||||
|
||||
void MainWindow::openFile()
|
||||
@@ -295,6 +299,7 @@ void MainWindow::applySettingsToEditor(SciEdit *editor)
|
||||
editor->setTabWidth(AppSettings::tabWidth());
|
||||
editor->setEditorFont(AppSettings::editorFont());
|
||||
editor->applyTheme(AppSettings::editorDarkTheme());
|
||||
editor->setIndentationGuides(m_indentGuidesEnabled ? SC_IV_LOOKBOTH : SC_IV_NONE);
|
||||
}
|
||||
|
||||
void MainWindow::applySettingsToAllEditors()
|
||||
@@ -366,6 +371,10 @@ void MainWindow::updateActions()
|
||||
copyAction->setEnabled(hasEditor);
|
||||
}
|
||||
if (QAction *pasteAction = actionCollection()->action(KStandardAction::name(KStandardAction::Paste))) {
|
||||
pasteAction->setEnabled(hasEditor);
|
||||
pasteAction->setEnabled(hasEditor && m_tabWidget->currentEditor()->canPaste());
|
||||
}
|
||||
if (QAction *indentGuideAction = actionCollection()->action(QStringLiteral("toggle_indent_guide"))) {
|
||||
indentGuideAction->setEnabled(hasEditor);
|
||||
indentGuideAction->setChecked(m_indentGuidesEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ private:
|
||||
void setupActions();
|
||||
void showSettings();
|
||||
void applyLexer(const QString & lexer);
|
||||
void applySettingsToEditor(SciEdit *editor);
|
||||
void applySettingsToAllEditors();
|
||||
void applySettingsToEditor(SciEdit *editor);
|
||||
void applySettingsToAllEditors();
|
||||
void updateWindowTitle();
|
||||
void updateStatusBar();
|
||||
void updateActions();
|
||||
@@ -42,6 +42,7 @@ private:
|
||||
QLabel *m_cursorPosStatusLabel;
|
||||
QLabel *m_encodingStatusLabel;
|
||||
QLabel *m_languageStatusLabel;
|
||||
bool m_indentGuidesEnabled = false;
|
||||
};
|
||||
|
||||
// plainly for KConfigDialog
|
||||
|
||||
Reference in New Issue
Block a user