Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Properties to QList and Some Refactoring #858

Merged
merged 17 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ __pycache__
.vscode/launch.json
.vscode/settings.json
.vscode/tasks.json
/cmake-build-debug/
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ else()
set(QT_VERSION_MAJOR 5)
endif()
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets LinguistTools)
message(STATUS "QT Major Version: " ${QT_VERSION_MAJOR})
set(QT_VERSION ${Qt${QT_VERSION_MAJOR}Core_VERSION})

message(STATUS "Qt Version: " ${QT_VERSION})

add_definitions(${QT_DEFINITIONS})
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand Down
34 changes: 27 additions & 7 deletions qucs-activefilter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,35 @@ else()
)
endif()

set(QT_VERSION ${Qt${QT_VERSION_MAJOR}Core_VERSION})

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (MSVC)
add_compile_options(/Zc:__cplusplus /permissive- /MP /Zc:preprocessor)
if (${QT_VERSION} VERSION_LESS "6.7.0")
set(CMAKE_CXX_STANDARD 17)
else()
# additional warnings
add_compile_options(-Wall -Wextra)
set(CMAKE_CXX_STANDARD 20)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS)
add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /Od /vmg)
add_compile_options(/wd4244 /wd4267 /wd4312)
else()
add_compile_options(-Wall -Wextra -O0 -g)
if (CMAKE_CXX_COMPILER_ID MATCHES "^AppleClang$|^Clang$")
add_compile_options(-Wno-ignored-attributes)
endif()
endif()
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS)
string(REGEX REPLACE "/W3" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /vmg)
else()
add_compile_options(-w)
endif()
endif()

ADD_DEFINITIONS(${QT_DEFINITIONS})
Expand Down
35 changes: 28 additions & 7 deletions qucs-attenuator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,37 @@ include_directories(
${Qt${QT_VERSION_MAJOR}Widgets_INCLUDE_DIRS}
)

set(QT_VERSION ${Qt${QT_VERSION_MAJOR}Core_VERSION})

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (MSVC)
add_compile_options(/Zc:__cplusplus /permissive- /MP /Zc:preprocessor)
if (${QT_VERSION} VERSION_LESS "6.7.0")
set(CMAKE_CXX_STANDARD 17)
else()
# additional warnings
add_compile_options(-Wall -Wextra)
set(CMAKE_CXX_STANDARD 20)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS)
add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /Od /vmg)
add_compile_options(/wd4244 /wd4267 /wd4312)
else()
add_compile_options(-Wall -Wextra -O0 -g)
if (CMAKE_CXX_COMPILER_ID MATCHES "^AppleClang$|^Clang$")
add_compile_options(-Wno-ignored-attributes)
endif()
endif()
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS)
string(REGEX REPLACE "/W3" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /vmg)
else()
add_compile_options(-w)
endif()
endif()

ADD_DEFINITIONS(${QT_DEFINITIONS})

#ADD_SUBDIRECTORY( bitmaps ) -> added as resources
Expand Down
33 changes: 27 additions & 6 deletions qucs-filter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,35 @@ include_directories(
)


set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(QT_VERSION ${Qt${QT_VERSION_MAJOR}Core_VERSION})

if (MSVC)
add_compile_options(/Zc:__cplusplus /permissive- /MP /Zc:preprocessor)
if (${QT_VERSION} VERSION_LESS "6.7.0")
set(CMAKE_CXX_STANDARD 17)
else()
# additional warnings
add_compile_options(-Wall -Wextra)
set(CMAKE_CXX_STANDARD 20)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS)
add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /Od /vmg)
add_compile_options(/wd4244 /wd4267 /wd4312)
else()
add_compile_options(-Wall -Wextra -O0 -g)
if (CMAKE_CXX_COMPILER_ID MATCHES "^AppleClang$|^Clang$")
add_compile_options(-Wno-ignored-attributes)
endif()
endif()
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS)
string(REGEX REPLACE "/W3" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /vmg)
else()
add_compile_options(-w)
endif()
endif()

ADD_DEFINITIONS(${QT_DEFINITIONS})
Expand Down
34 changes: 27 additions & 7 deletions qucs-powercombining/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,35 @@ else()
)
endif()

set(QT_VERSION ${Qt${QT_VERSION_MAJOR}Core_VERSION})

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (MSVC)
add_compile_options(/Zc:__cplusplus /permissive- /MP /Zc:preprocessor)
if (${QT_VERSION} VERSION_LESS "6.7.0")
set(CMAKE_CXX_STANDARD 17)
else()
# additional warnings
add_compile_options(-Wall -Wextra)
set(CMAKE_CXX_STANDARD 20)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS)
add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /Od /vmg)
add_compile_options(/wd4244 /wd4267 /wd4312)
else()
add_compile_options(-Wall -Wextra -O0 -g)
if (CMAKE_CXX_COMPILER_ID MATCHES "^AppleClang$|^Clang$")
add_compile_options(-Wno-ignored-attributes)
endif()
endif()
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS)
string(REGEX REPLACE "/W3" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /vmg)
else()
add_compile_options(-w)
endif()
endif()

ADD_DEFINITIONS(${QT_DEFINITIONS})
Expand Down
2 changes: 1 addition & 1 deletion qucs-powercombining/qucspowercombiningtool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ QString QucsPowerCombiningTool::calcChebyLines(double RL, double Z0, double gamm
//double sec_theta_m = cosh((1/(1.*N))*acosh(fabs(log(RL/Z0)/(2*gamma))) );
(fabs(log(RL/Z0)/(2*gamma)) < 1) ? sec_theta_m = 0 : sec_theta_m = cosh((1/(1.*N))*acosh(fabs(log(RL/Z0)/(2*gamma))) );

double w[7]; // for msvc predefined size.
std::vector<double> w(N,0.0);

switch(N)//The weights are calculated by equating the reflection coeffient formula to the N-th Chebyshev polinomial
{
Expand Down
33 changes: 27 additions & 6 deletions qucs-transcalc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,35 @@ include_directories(
)


set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(QT_VERSION ${Qt${QT_VERSION_MAJOR}Core_VERSION})

if (MSVC)
add_compile_options(/Zc:__cplusplus /permissive- /MP /Zc:preprocessor)
if (${QT_VERSION} VERSION_LESS "6.7.0")
set(CMAKE_CXX_STANDARD 17)
else()
# additional warnings
add_compile_options(-Wall -Wextra)
set(CMAKE_CXX_STANDARD 20)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS)
add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /Od /vmg)
add_compile_options(/wd4244 /wd4267 /wd4312)
else()
add_compile_options(-Wall -Wextra -O0 -g)
if (CMAKE_CXX_COMPILER_ID MATCHES "^AppleClang$|^Clang$")
add_compile_options(-Wno-ignored-attributes)
endif()
endif()
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS)
string(REGEX REPLACE "/W3" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /vmg)
else()
add_compile_options(-w)
endif()
endif()

ADD_DEFINITIONS(${QT_DEFINITIONS})
Expand Down
78 changes: 50 additions & 28 deletions qucs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,40 @@ CONFIGURE_FILE (
INCLUDE_DIRECTORIES("${PROJECT_BINARY_DIR}")

IF(QT_VERSION_MAJOR EQUAL 6)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
ENDIF()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (MSVC)
add_compile_options(/Zc:__cplusplus /permissive- /MP /Zc:preprocessor)
set(QT_VERSION ${Qt${QT_VERSION_MAJOR}Core_VERSION})

if (${QT_VERSION} VERSION_LESS "6.7.0")
set(CMAKE_CXX_STANDARD 17)
else()
# additional warnings
add_compile_options(-Wall -Wextra)
set(CMAKE_CXX_STANDARD 20)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS)
add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /Od /vmg)
add_compile_options(/wd4244 /wd4267 /wd4312)
else()
add_compile_options(-Wall -Wextra -O0 -g)
if (CMAKE_CXX_COMPILER_ID MATCHES "^AppleClang$|^Clang$")
add_compile_options(-Wno-ignored-attributes)
endif()
endif()
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS)
string(REGEX REPLACE "/W3" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /vmg)
else()
add_compile_options(-w)
endif()
endif()

INCLUDE_DIRECTORIES(
Expand Down Expand Up @@ -209,25 +231,25 @@ endif()
# configure Apple bundle information
#
IF(APPLE)
# set information on Info.plist file
SET(MACOSX_BUNDLE_INFO_STRING "${PROJECT_NAME} ${PROJECT_VERSION}")
SET(MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_NAME} ${PROJECT_VERSION}")
SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_NAME} ${PROJECT_VERSION}")
SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}")
SET(MACOSX_BUNDLE_COPYRIGHT "${PROJECT_COPYRIGHT_YEAR} ${PROJECT_VENDOR}")
SET(MACOSX_BUNDLE_GUI_IDENTIFIER "${PROJECT_DOMAIN_SECOND}.${PROJECT_DOMAIN_FIRST}")
SET(MACOSX_BUNDLE_BUNDLE_NAME "${PROJECT_NAME}")
SET(MACOSX_BUNDLE_ICON_FILE qucs.icns)

# set where in the bundle to put the icns file
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/bitmaps/qucs.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
# include the icns file in the target
SET(QUCS_SRCS ${QUCS_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/bitmaps/qucs.icns)

# This tells cmake where to place the translations inside the bundle
#SET_SOURCE_FILES_PROPERTIES( ${LANG_SRCS} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/lang )
# include the translation files in the target
#SET(RESOURCES_SRCS ${RESOURCES_SRCS} ${LANG_SRCS})
# set information on Info.plist file
SET(MACOSX_BUNDLE_INFO_STRING "${PROJECT_NAME} ${PROJECT_VERSION}")
SET(MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_NAME} ${PROJECT_VERSION}")
SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_NAME} ${PROJECT_VERSION}")
SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}")
SET(MACOSX_BUNDLE_COPYRIGHT "${PROJECT_COPYRIGHT_YEAR} ${PROJECT_VENDOR}")
SET(MACOSX_BUNDLE_GUI_IDENTIFIER "${PROJECT_DOMAIN_SECOND}.${PROJECT_DOMAIN_FIRST}")
SET(MACOSX_BUNDLE_BUNDLE_NAME "${PROJECT_NAME}")
SET(MACOSX_BUNDLE_ICON_FILE qucs.icns)

# set where in the bundle to put the icns file
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/bitmaps/qucs.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
# include the icns file in the target
SET(QUCS_SRCS ${QUCS_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/bitmaps/qucs.icns)

# This tells cmake where to place the translations inside the bundle
#SET_SOURCE_FILES_PROPERTIES( ${LANG_SRCS} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/lang )
# include the translation files in the target
#SET(RESOURCES_SRCS ${RESOURCES_SRCS} ${LANG_SRCS})
ENDIF(APPLE)


Expand Down
2 changes: 1 addition & 1 deletion qucs/components/DLS_1ton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ DLS_1ton::DLS_1ton()
Component * DLS_1ton::newOne()
{
DLS_1ton * p = new DLS_1ton();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/DLS_nto1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ DLS_nto1::DLS_nto1()
Component * DLS_nto1::newOne()
{
DLS_nto1 * p = new DLS_nto1();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/MESFET.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ MESFET::MESFET()
Component * MESFET::newOne()
{
MESFET * p = new MESFET();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
21 changes: 9 additions & 12 deletions qucs/components/ac_sim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,18 @@ Element* AC_Sim::info(QString& Name, char* &BitmapFile, bool getNewOne)

void AC_Sim::recreate(Schematic*)
{
Property *pp = Props.first();
if((pp->Value == "list") || (pp->Value == "const")) {
if((Props.at(0)->Value == "list") || (Props.at(0)->Value == "const")) {
// Call them "Symbol" to omit them in the netlist.
pp = Props.next();
pp->Name = "Symbol";
pp->display = false;
pp = Props.next();
pp->Name = "Symbol";
pp->display = false;
Props.next()->Name = "Values";
Props.at(1)->Name = "Symbol";
Props.at(1)->display = false;
Props.at(2)->Name = "Symbol";
Props.at(2)->display = false;
Props.at(3)->Name = "Values";
}
else {
Props.next()->Name = "Start";
Props.next()->Name = "Stop";
Props.next()->Name = "Points";
Props.at(1)->Name = "Start";
Props.at(2)->Name = "Stop";
Props.at(3)->Name = "Points";
}
}

Expand Down
Loading
Loading