diff --git a/.gitignore b/.gitignore index 72ec57a..b882ef5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ # IDE stuff CMakeLists.txt.user* +.qtcreator/ # Clangd .cache/ diff --git a/editorviewhelper.cpp b/editorviewhelper.cpp index 47ec85e..a00f4ff 100644 --- a/editorviewhelper.cpp +++ b/editorviewhelper.cpp @@ -37,6 +37,7 @@ QString LexerGroupActionMenu::displayName(const QString &lexerName) {"cmake", "CMake"}, {"hypertext", "HTML"}, {"xml", "XML"}, + {"yaml", "YAML"}, {"json", "JSON"}, {"css", "CSS"}, {"powershell", "PowerShell"} diff --git a/generalsettings.ui b/generalsettings.ui index dc93f55..1e8c986 100644 --- a/generalsettings.ui +++ b/generalsettings.ui @@ -17,7 +17,7 @@ - tAB wIDTH + Tab width @@ -37,7 +37,7 @@ - eDITOR fONT + Editor font @@ -47,7 +47,7 @@ - eDITOR dARK tHEME + Editor dark theme diff --git a/main.cpp b/main.cpp index cdbbcae..906ec72 100644 --- a/main.cpp +++ b/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"))); diff --git a/mainwindow.cpp b/mainwindow.cpp index da05e9f..a3cca80 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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); } } diff --git a/mainwindow.h b/mainwindow.h index 08e1a87..dc98f44 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -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