Skip to content

Commit bc77a14

Browse files
Copiloturbytes21
andcommitted
Fix PR #53 review issues: cppcheck errors, missing includes, markup injection, code quality
- Fix initializer list order in DisplayWidget.cpp and EditorWidget.cpp (CI blocker) - Add missing #include <string> in IObserver.h - Add missing #pragma once in DisplayWidget.h - Remove unnecessary Controller.h include in DisplayWidget.h - Remove debug cout statements and redundant assignment in EditorWidget.cpp - Escape user text in Pango markup (DisplayWidget.cpp, simple_ap.cpp) - Fix README.md: correct typos and swap pros/cons content - Add missing newline at end of all new files Co-authored-by: urbytes21 <118428350+urbytes21@users.noreply.github.com>
1 parent c6e073d commit bc77a14

File tree

15 files changed

+36
-34
lines changed

15 files changed

+36
-34
lines changed

cmake/Dependencies.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ FetchContent_MakeAvailable(googletest)
2222
find_package(PkgConfig REQUIRED)
2323

2424
# Check for gtkmm-4.0 specifically, not just gtk4
25-
pkg_check_modules(GTKMM REQUIRED gtkmm-4.0)
25+
pkg_check_modules(GTKMM REQUIRED gtkmm-4.0)

src/ap/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ target_sources(ap
1818
target_link_libraries(ap PRIVATE gtk4-settings)
1919

2020
add_subdirectory(mvc)
21-
# add_subdirectory(mvvm)
21+
# add_subdirectory(mvvm)

src/ap/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ View → Controller → Model
4646

4747
### 4. Examples
4848
### 4.1. simple_ap
49-
- Cos:
49+
- Pros:
5050
- Quick, Simple
51-
- Pos:
51+
- Cons:
5252
- Dependency: e.g. what happen when we delete Gtk::Label m_labelMonitorA;
5353
- Scalability:
5454
- Reusability:
5555

56-
### 4.2. mvc_ap
56+
### 4.2. mvc_ap

src/ap/mvc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ target_sources(mvc_ap
99
controller/Controller.cpp
1010
)
1111

12-
target_link_libraries(mvc_ap PRIVATE gtk4-settings)
12+
target_link_libraries(mvc_ap PRIVATE gtk4-settings)

src/ap/mvc/IObserver.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#pragma once
2+
#include <string>
23

34
class IObserver {
45
public:
56
virtual ~IObserver() = default;
67
virtual void onDataChanged(const std::string& newData) = 0;
7-
};
8+
};

src/ap/mvc/controller/Controller.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ void Controller::updateRequest(const std::string& text) {
99
// the Controller updates the Model when receiving new data from the View,
1010
// which then notifies all Views of the change
1111
model_->setData(text);
12-
}
12+
}

src/ap/mvc/controller/Controller.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ class Controller {
1010

1111
private:
1212
std::shared_ptr<SharedData> model_;
13-
};
13+
};

src/ap/mvc/model/SharedData.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ void SharedData::addObserver(IObserver* obs) {
2020

2121
std::string SharedData::getData() const {
2222
return data_;
23-
}
23+
}

src/ap/mvc/model/SharedData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ class SharedData {
1818
private:
1919
std::string data_;
2020
std::vector<IObserver*> observers_;
21-
};
21+
};

src/ap/mvc/mvc_ap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ ContainerWindow::ContainerWindow()
7171
int main(int argc, char* argv[]) {
7272
auto app = Gtk::Application::create("org.gtkmm.example.singlemvc");
7373
return app->make_window_and_run<ContainerWindow>(argc, argv);
74-
}
74+
}

0 commit comments

Comments
 (0)