Skip to content

Commit cf87b37

Browse files
author
Artur Bać
committed
add tool winfows - workinprogress
1 parent ceeafb8 commit cf87b37

File tree

5 files changed

+79
-0
lines changed

5 files changed

+79
-0
lines changed

CMakeLists.txt

+10
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,16 @@ include(FeatureSummary)
117117

118118
find_package(KDevPlatform 5.2.40 REQUIRED)
119119

120+
# Find the required Qt and KDE modules
121+
find_package(Qt5 COMPONENTS Widgets WebEngineWidgets REQUIRED)
122+
find_package(KF5CoreAddons REQUIRED)
123+
find_package(KF5WidgetsAddons REQUIRED)
124+
find_package(KF5I18n REQUIRED)
125+
126+
# Instruct CMake to run moc, uic, and rcc automatically
127+
set(CMAKE_AUTOMOC ON)
128+
set(CMAKE_AUTOUIC ON)
129+
set(CMAKE_AUTORCC ON)
120130

121131
add_subdirectory(src)
122132

cmake/spdx_check.cmake

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# List of directories to check
2+
set(DIRECTORIES_TO_CHECK "src" "ai_processing" "unittests" )
3+
4+
# Generate the find command argument list from the directories
5+
set(FIND_CMD_DIRS "")
6+
foreach(DIR IN LISTS DIRECTORIES_TO_CHECK)
7+
list(APPEND FIND_CMD_DIRS ${CMAKE_SOURCE_DIR}/${DIR})
8+
endforeach()
9+
10+
# SPDX check command using shell commands (Unix/Linux)
11+
add_custom_target(spdx_check
12+
COMMAND ${CMAKE_COMMAND} -E echo "Checking for SPDX-License-Identifier tags in .h, .hpp, .c, .cc, .cpp files within specified directories..."
13+
COMMAND find ${FIND_CMD_DIRS} -type f "\\(" -name "*.h" -o -name "*.hpp" -o -name "*.c" -o -name "*.cc" -o -name "*.cpp" "\\)" -exec grep -L "SPDX-License-Identifier" {} +
14+
COMMAND ${CMAKE_COMMAND} -E echo "Check complete. Files listed above are missing SPDX-License-Identifier tags."
15+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
16+
COMMENT "SPDX tag check..."
17+
)
18+

src/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ set(kdevcxx_with_ai_SRCS
66
kdevcxx_with_ai.cc
77
info_dialog.cc
88
plugin_settings.cc
9+
markdown_view.cc
910
${CXX_WITH_GPT_UI_HEADERS}
1011
)
1112

@@ -16,6 +17,8 @@ kdevplatform_add_plugin(kdevcxx_with_ai
1617
target_link_libraries(kdevcxx_with_ai
1718
KDev::Interfaces
1819
ai_processing::core
20+
Qt5::Widgets
21+
Qt5::WebEngineWidgets
1922
${BASIC_LINK_FLAGS}
2023
)
2124
target_compile_options( kdevcxx_with_ai PRIVATE "-fexceptions")

src/markdown_view.cc

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include "markdown_view.h"
2+
#include <qtextstream.h>
3+
4+
void markdown_view::load_markdown(QString const & html_content)
5+
{
6+
// QFile file(file_path);
7+
// if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
8+
// return;
9+
10+
// QTextStream in(&file);
11+
// QString markdown_content = in.readAll();
12+
13+
// QString html_content = convert_markdown_to_html(markdown_content); // Assume this function exists
14+
15+
web_view->setHtml(html_content);
16+
}
17+
18+
// QString markdown_view::convert_markdown_to_html(QString const & markdown)
19+
// {
20+
// // Placeholder for Markdown to HTML conversion
21+
// QString html_content = "<html><body>" + markdown.toHtmlEscaped() + "</body></html>";
22+
// return html_content;
23+
// }
24+

src/markdown_view.h

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// SPDX-FileCopyrightText: 2024 Artur Bać
2+
// SPDX-License-Identifier: MIT
3+
4+
#pragma once
5+
6+
#include <qdockwidget.h>
7+
#include <QWebEngineView>
8+
#include <qfile.h>
9+
10+
class markdown_view : public QDockWidget
11+
{
12+
Q_OBJECT
13+
public:
14+
explicit markdown_view(QWidget * parent = nullptr) : QDockWidget(parent)
15+
{
16+
web_view = new QWebEngineView(this);
17+
setWidget(web_view);
18+
}
19+
20+
void load_markdown(QString const & file_path);
21+
22+
private:
23+
QWebEngineView * web_view;
24+
};

0 commit comments

Comments
 (0)