From 938d44bf62c4993aa6c2d0eec2e2a41f1cbb76b0 Mon Sep 17 00:00:00 2001 From: Remisa Yousefvand Date: Tue, 3 Dec 2024 15:04:58 +0330 Subject: [PATCH] v0.0.62 --- CHANGELOG.md | 5 +++++ CMakeLists.txt.user | 22 +++++++++++----------- src/codeeditor.cpp | 21 +++++++++++++++------ src/codeeditor.h | 4 ++-- src/mainwindow.cpp | 12 ++++++++++-- src/mainwindow.h | 2 ++ src/mainwindow/mainwindowconfigloader.cpp | 6 +++++- src/mainwindow/mainwindowconfigloader.h | 1 + 8 files changed, 51 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2e0018..0d9611b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ============ +## 0.0.62 + +- Implemented: +- View Menu -> Show All Characters + ## 0.0.61 - Implemented: diff --git a/CMakeLists.txt.user b/CMakeLists.txt.user index aec86de..3192a44 100755 --- a/CMakeLists.txt.user +++ b/CMakeLists.txt.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -102,14 +102,14 @@ 2 false - -DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake --DCMAKE_GENERATOR:STRING=Ninja --DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx} --DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX} + -DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx} -DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG} -DCMAKE_BUILD_TYPE:STRING=Debug +-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX} +-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C} -DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable} --DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C} +-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake +-DCMAKE_GENERATOR:STRING=Ninja /data/Code/Qt/Notepad-- 0 /data/Code/Qt/Notepad--/build/Desktop-Debug @@ -160,14 +160,14 @@ 2 false - -DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake --DCMAKE_GENERATOR:STRING=Ninja --DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx} --DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX} + -DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx} -DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG} -DCMAKE_BUILD_TYPE:STRING=Release +-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX} +-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C} -DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable} --DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C} +-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake +-DCMAKE_GENERATOR:STRING=Ninja /data/Code/Qt/Notepad-- /data/Code/Qt/Notepad--/build/Desktop-Release diff --git a/src/codeeditor.cpp b/src/codeeditor.cpp index a21af3e..8eaace1 100755 --- a/src/codeeditor.cpp +++ b/src/codeeditor.cpp @@ -33,7 +33,14 @@ CodeEditor::CodeEditor(QWidget *parent) m_showTabs = Settings::instance()->loadSetting("View", "ShowTabs", "false") == "true"; m_showSpaces = Settings::instance()->loadSetting("View", "ShowSpaces", "false") == "true"; m_showEOL = Settings::instance()->loadSetting("View", "ShowEOL", "false") == "true"; + m_showAllCharacters = Settings::instance()->loadSetting("View", "ShowAllCharacters", "false") == "true"; m_tabWidth = Settings::instance()->loadSetting("View", "TabWidth", "4").toInt(); + + if (m_showAllCharacters) { + m_showTabs = true; + m_showSpaces = true; + m_showEOL = true; + } } int CodeEditor::lineNumberAreaWidth() { @@ -279,12 +286,14 @@ void CodeEditor::setShowEOL(bool enabled) { } } -bool CodeEditor::showTabs() const { - return m_showTabs; -} - -bool CodeEditor::showSpaces() const { - return m_showSpaces; +void CodeEditor::setShowAllCharacters(bool enabled) { + if (m_showAllCharacters != enabled) { + m_showAllCharacters = enabled; + m_showTabs = enabled; + m_showSpaces = enabled; + m_showEOL = enabled; + viewport()->update(); + } } // TODO: Implement in UI diff --git a/src/codeeditor.h b/src/codeeditor.h index 3023f7f..844ec7f 100755 --- a/src/codeeditor.h +++ b/src/codeeditor.h @@ -27,8 +27,7 @@ class CodeEditor : public QPlainTextEdit { void setShowTabs(bool enabled); void setShowSpaces(bool enabled); void setShowEOL(bool enabled); - bool showTabs() const; - bool showSpaces() const; + void setShowAllCharacters(bool enabled); void setTabWidth(int width); protected: @@ -51,6 +50,7 @@ private slots: bool m_showTabs = false; bool m_showSpaces = false; bool m_showEOL = false; + bool m_showAllCharacters = false; int m_tabWidth; }; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 41031fa..2fcb5fc 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -536,7 +536,17 @@ void MainWindow::on_actionShow_End_of_Lines_triggered(bool checked) } } +void MainWindow::on_actionShow_All_Characters_triggered(bool checked) +{ + Settings::instance()->saveSetting("View", "ShowAllCharacters", checked); + for (int i = 0; i < ui->documentsTab->count(); ++i) { + Document *doc = qobject_cast(ui->documentsTab->widget(i)); + if (doc) { + doc->editor()->setShowAllCharacters(checked); + } + } +} @@ -707,5 +717,3 @@ void MainWindow::on_actionAbout_Qt_triggered() } - - diff --git a/src/mainwindow.h b/src/mainwindow.h index 7d8f2cf..5c792b3 100755 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -156,6 +156,8 @@ private slots: void on_actionShow_End_of_Lines_triggered(bool checked); + void on_actionShow_All_Characters_triggered(bool checked); + private: Ui::MainWindow* ui; FileOperations* fileOperations; diff --git a/src/mainwindow/mainwindowconfigloader.cpp b/src/mainwindow/mainwindowconfigloader.cpp index 40c8c4c..4880590 100644 --- a/src/mainwindow/mainwindowconfigloader.cpp +++ b/src/mainwindow/mainwindowconfigloader.cpp @@ -1,7 +1,6 @@ #include "../settings.h" #include "../mainwindow.h" #include "../ui_mainwindow.h" -#include "src/ui_mainwindow.h" #include "mainwindowconfigloader.h" MainWindowConfigLoader::MainWindowConfigLoader(MainWindow *mainWindow) : m_mainWindow(mainWindow) {} @@ -11,6 +10,7 @@ void MainWindowConfigLoader::loadMainWindowConfig() { m_mainWindow->getUi()->action_Show_Tabs->setChecked(showTabs()); m_mainWindow->getUi()->actionShow_Spaces->setChecked(showSpaces()); m_mainWindow->getUi()->actionShow_End_of_Lines->setChecked(showEOL()); + m_mainWindow->getUi()->actionShow_All_Characters->setChecked(showAllCharacters()); } } @@ -26,4 +26,8 @@ bool MainWindowConfigLoader::showEOL() const { return Settings::instance()->loadSetting("View", "ShowEOL", "false") == true; } +bool MainWindowConfigLoader::showAllCharacters() const { + return Settings::instance()->loadSetting("View", "ShowAllCharacters", "false") == true; +} + diff --git a/src/mainwindow/mainwindowconfigloader.h b/src/mainwindow/mainwindowconfigloader.h index d69a9dc..9953031 100644 --- a/src/mainwindow/mainwindowconfigloader.h +++ b/src/mainwindow/mainwindowconfigloader.h @@ -14,5 +14,6 @@ class MainWindowConfigLoader bool showTabs() const; bool showSpaces() const; bool showEOL() const; + bool showAllCharacters() const; };