diff --git a/CMakeLists.txt b/CMakeLists.txt index d7243eb1..0f1429d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -192,7 +192,7 @@ configure_file( #configure the versioning file configure_file( - ${CMAKE_SOURCE_DIR}/src/lib_gui/version.h.in + ${CMAKE_SOURCE_DIR}/cmake/version.h.in ${CMAKE_SOURCE_DIR}/build/src/lib_gui/version.h ) diff --git a/cmake/licenses.cmake b/cmake/licenses.cmake index 034ec99f..d733666b 100644 --- a/cmake/licenses.cmake +++ b/cmake/licenses.cmake @@ -14,22 +14,22 @@ function(ReadLicense licenseFile licenseVariable) set(LICENSES "${LICENSES}${var}${tempVariable}\"\;" PARENT_SCOPE) endfunction(ReadLicense) -function(AddLicense licenseName licenseURL licenseFile) - ReadLicense(${licenseFile} ${licenseName}_license) - set(LICENSES ${LICENSES} PARENT_SCOPE) - set(LICENSE_ARRAY "${LICENSE_ARRAY}\n\tThirdPartyLicense(\"${licenseName}\", \"${licenseURL}\", ${licenseName}_license)," PARENT_SCOPE) +function(AddLicense licenseName licenseURL licenseFile isNotInTrial) + ReadLicense(${licenseFile} ${licenseName}_license) + set(LICENSES ${LICENSES} PARENT_SCOPE) + set(LICENSE_ARRAY "${LICENSE_ARRAY}\n\tThirdPartyLicense(\"${licenseName}\", \"${licenseURL}\", ${licenseName}_license, ${isNotInTrial})," PARENT_SCOPE) endfunction(AddLicense) -AddLicense("Qt" "http://qt.io" "${LICENSEFOLDER}/qt_LICENSE.TXT") -AddLicense("Clang" "http://clang.llvm.org/" "${LICENSEFOLDER}/clang_LICENSE.TXT") -AddLicense("Boost" "http://www.boost.org" "${LICENSEFOLDER}/boost_LICENSE.TXT") -AddLicense("TinyXMl" "http://www.grinninglizard.com/tinyxml2/" "${LICENSEFOLDER}/tinyxml_LICENSE.TXT") -AddLicense("CppSQLite" "http://www.codeproject.com/Articles/6343/CppSQLite-C-Wrapper-for-SQLite" "${LICENSEFOLDER}/CppSQLite_LICENSE.TXT") -AddLicense("Eigen" "http://eigen.tuxfamily.org" "${LICENSEFOLDER}/eigen_LICENSE.TXT") +AddLicense("Qt" "http://qt.io" "${LICENSEFOLDER}/qt_LICENSE.TXT" false) +AddLicense("Clang" "http://clang.llvm.org/" "${LICENSEFOLDER}/clang_LICENSE.TXT" true) +AddLicense("Boost" "http://www.boost.org" "${LICENSEFOLDER}/boost_LICENSE.TXT" false) +AddLicense("TinyXMl" "http://www.grinninglizard.com/tinyxml2/" "${LICENSEFOLDER}/tinyxml_LICENSE.TXT" false) +AddLicense("CppSQLite" "http://www.codeproject.com/Articles/6343/CppSQLite-C-Wrapper-for-SQLite" "${LICENSEFOLDER}/CppSQLite_LICENSE.TXT" false) +AddLicense("Eigen" "http://eigen.tuxfamily.org" "${LICENSEFOLDER}/eigen_LICENSE.TXT" false) set(LICENSE_ARRAY "${LICENSE_ARRAY}\n") configure_file( - ${CMAKE_SOURCE_DIR}/src/lib_gui/licenses.h.in - ${CMAKE_SOURCE_DIR}/build/src/lib_gui/licenses.h + ${CMAKE_SOURCE_DIR}/cmake/licenses.h.in + ${CMAKE_SOURCE_DIR}/build/src/lib_gui/licenses.h ) diff --git a/src/lib_gui/licenses.h.in b/cmake/licenses.h.in similarity index 60% rename from src/lib_gui/licenses.h.in rename to cmake/licenses.h.in index ff87d094..c37c6abd 100644 --- a/src/lib_gui/licenses.h.in +++ b/cmake/licenses.h.in @@ -1,16 +1,17 @@ #ifndef LICENSES_H #define LICENSES_H -// This File(licenses.h) is generated with CMake +// This File(licenses.h) is generated with CMake struct ThirdPartyLicense { const char* name; const char* url; const char* license; + const bool isNotInTrial; - ThirdPartyLicense() : name(0), url(0), license(0) {} - ThirdPartyLicense(const char* name, const char* url, const char* license) - : name(name), url(url), license(license) {} + ThirdPartyLicense() : name(0), url(0), license(0), isNotInTrial(false) {} + ThirdPartyLicense(const char* name, const char* url, const char* license, const bool isNotInTrial) + : name(name), url(url), license(license), isNotInTrial(isNotInTrial) {} bool isEmpty() const { return (name == 0 && url == 0 && license == 0); } }; diff --git a/cmake/version.cmake b/cmake/version.cmake index 99c34bc5..337a6787 100644 --- a/cmake/version.cmake +++ b/cmake/version.cmake @@ -43,6 +43,6 @@ message(STATUS "Git commit time: ${GIT_COMMIT_TIME}") message(STATUS "Git version number:" ${GIT_VERSION_NUMBER} ) configure_file( - ${CMAKE_SOURCE_DIR}/src/lib_gui/version.h.in + ${CMAKE_SOURCE_DIR}/cmake/version.h.in ${CMAKE_SOURCE_DIR}/build/src/lib_gui/version.h ) diff --git a/src/lib_gui/version.h.in b/cmake/version.h.in similarity index 100% rename from src/lib_gui/version.h.in rename to cmake/version.h.in diff --git a/src/app/isTrial.cpp b/src/app/isTrial.cpp index 17893654..2fcc5596 100644 --- a/src/app/isTrial.cpp +++ b/src/app/isTrial.cpp @@ -1,6 +1,6 @@ #include "isTrial.h" -bool isTrail() +bool isTrial() { return false; } diff --git a/src/lib/data/SqliteStorage.cpp b/src/lib/data/SqliteStorage.cpp index 731ee8d5..e1fdf009 100644 --- a/src/lib/data/SqliteStorage.cpp +++ b/src/lib/data/SqliteStorage.cpp @@ -112,7 +112,8 @@ Id SqliteStorage::addFile(Id nameId, const std::string& filePath, const std::str return id; } -int SqliteStorage::addSourceLocation(Id elementId, Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol, bool isScope) +Id SqliteStorage::addSourceLocation(Id elementId, Id fileNodeId, uint startLine, uint startCol, uint endLine, + uint endCol, bool isScope) { m_database.execDML(( "INSERT INTO source_location(id, element_id, file_node_id, start_line, start_column, end_line, end_column, is_scope) " diff --git a/src/lib/data/SqliteStorage.h b/src/lib/data/SqliteStorage.h index 18b65661..f1e39ed7 100644 --- a/src/lib/data/SqliteStorage.h +++ b/src/lib/data/SqliteStorage.h @@ -36,7 +36,8 @@ public: Id addEdge(int type, Id sourceNodeId, Id targetNodeId); Id addNode(int type, Id nameId, bool defined); Id addFile(Id nameId, const std::string& filePath, const std::string& modificationTime); - int addSourceLocation(Id elementId, Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol, bool isScope); + Id addSourceLocation(Id elementId, Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol, + bool isScope); Id addNameHierarchyElement(const std::string& name, Id parentId = 0); Id addComponentAccess(Id memberEdgeId, int type); diff --git a/src/lib/data/Storage.cpp b/src/lib/data/Storage.cpp index dc88851f..fc87682b 100644 --- a/src/lib/data/Storage.cpp +++ b/src/lib/data/Storage.cpp @@ -778,8 +778,8 @@ Id Storage::getIdForNodeWithNameHierarchy(const NameHierarchy& nameHierarchy) co Id Storage::getIdForEdge( Edge::EdgeType type, const NameHierarchy& fromNameHierarchy, const NameHierarchy& toNameHierarchy ) const { - int sourceId = getIdForNodeWithNameHierarchy(fromNameHierarchy); - int targetId = getIdForNodeWithNameHierarchy(toNameHierarchy); + Id sourceId = getIdForNodeWithNameHierarchy(fromNameHierarchy); + Id targetId = getIdForNodeWithNameHierarchy(toNameHierarchy); return m_sqliteStorage.getEdgeBySourceTargetType(sourceId, targetId, type).id; } @@ -1169,7 +1169,7 @@ std::shared_ptr Storage::getTokenLocationsForLinesInFile( } uint endLineNumber = locationFile->getTokenLocationLines().rbegin()->first; - std::set addedLocationIds; + std::set addedLocationIds; for (uint i = firstLineNumber; i <= endLineNumber; i++) { TokenLocationLine* locationLine = locationFile->findTokenLocationLineByNumber(i); @@ -1365,7 +1365,7 @@ std::vector Storage::addNameHierarchyElements(NameHierarchy nameHierarchy) for (size_t i = 0; i < nameHierarchy.size(); i++) { const std::string elementName = nameHierarchy[i]->getFullName(); - int nodeId = 0; + Id nodeId = 0; if (nodeMayExist) { @@ -1385,7 +1385,7 @@ std::vector Storage::addNameHierarchyElements(NameHierarchy nameHierarchy) return nameIds; } -int Storage::addSourceLocation(int elementNodeId, const ParseLocation& location, bool isScope) +Id Storage::addSourceLocation(Id elementNodeId, const ParseLocation &location, bool isScope) { if (!location.isValid()) { @@ -1407,7 +1407,7 @@ int Storage::addSourceLocation(int elementNodeId, const ParseLocation& location, return 0; } - int locationId = m_sqliteStorage.getSourceLocationByData( + Id locationId = m_sqliteStorage.getSourceLocationByData( elementNodeId, fileNodeId, location.startLineNumber, location.startColumnNumber, location.endLineNumber, location.endColumnNumber, isScope ).id; @@ -1595,7 +1595,7 @@ void Storage::addAggregationEdgesToGraph(const Id nodeId, Graph* graph) const for (const std::pair> p : connectedParentNodeIds) { - const int aggregationTargetNodeId = p.first; + const Id aggregationTargetNodeId = p.first; Node* targetNode = graph->getNodeById(aggregationTargetNodeId); if (!targetNode) @@ -1674,6 +1674,8 @@ TokenComponentAccess::AccessType Storage::convertAccessType(ParserClient::Access return TokenComponentAccess::ACCESS_PRIVATE; case ACCESS_NONE: return TokenComponentAccess::ACCESS_NONE; + default: + return TokenComponentAccess::ACCESS_NONE; } } diff --git a/src/lib/data/Storage.h b/src/lib/data/Storage.h index 6b338bd0..c16e5e87 100644 --- a/src/lib/data/Storage.h +++ b/src/lib/data/Storage.h @@ -7,7 +7,6 @@ #include "utility/file/FilePath.h" #include "data/access/StorageAccess.h" -//#include "data/graph/token_component/TokenComponentAbstraction.h" #include "data/HierarchyCache.h" #include "data/graph/token_component/TokenComponentAccess.h" #include "data/location/TokenLocationCollection.h" @@ -174,7 +173,7 @@ private: Id addNodeHierarchy(Node::NodeType nodeType, NameHierarchy nameHierarchy, bool defined, bool distinct = false); Id addNodeHierarchyWithDistinctSignature(Node::NodeType type, const ParseFunction& function, bool defined); std::vector addNameHierarchyElements(NameHierarchy nameHierarchy); - int addSourceLocation(int elementNodeId, const ParseLocation& location, bool isScope = false); + Id addSourceLocation(Id elementNodeId, const ParseLocation &location, bool isScope = false); Id addEdge(Id sourceNodeId, Id targetNodeId, Edge::EdgeType type); Id addEdge(Id sourceNodeId, Id targetNodeId, Edge::EdgeType type, ParseLocation location); diff --git a/src/lib/data/StorageTypes.h b/src/lib/data/StorageTypes.h index 805fb17b..992fc26b 100644 --- a/src/lib/data/StorageTypes.h +++ b/src/lib/data/StorageTypes.h @@ -63,7 +63,7 @@ struct StorageNameHierarchyElement struct StorageSourceLocation { - StorageSourceLocation(Id id, Id elementId, Id fileNodeId, int startLine, int startCol, int endLine, int endCol, bool isScope) + StorageSourceLocation(Id id, Id elementId, Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol, bool isScope) : id(id) , elementId(elementId) , fileNodeId(fileNodeId) @@ -77,10 +77,10 @@ struct StorageSourceLocation Id id; Id elementId; Id fileNodeId; - int startLine; - int startCol; - int endLine; - int endCol; + uint startLine; + uint startCol; + uint endLine; + uint endCol; bool isScope; }; @@ -97,7 +97,7 @@ struct StorageComponentAccess struct StorageCommentLocation { - StorageCommentLocation(Id id, Id fileNodeId, int startLine, int startCol, int endLine, int endCol) + StorageCommentLocation(Id id, Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol) : id(id) , fileNodeId(fileNodeId) , startLine(startLine) @@ -108,10 +108,10 @@ struct StorageCommentLocation Id id; Id fileNodeId; - int startLine; - int startCol; - int endLine; - int endCol; + uint startLine; + uint startCol; + uint endLine; + uint endCol; }; struct StorageError diff --git a/src/lib/data/parser/ParserClient.cpp b/src/lib/data/parser/ParserClient.cpp index a0ad434b..52e0efc3 100644 --- a/src/lib/data/parser/ParserClient.cpp +++ b/src/lib/data/parser/ParserClient.cpp @@ -21,6 +21,8 @@ std::string ParserClient::addAccessPrefix(const std::string& str, AccessType acc return "private " + str; case ACCESS_NONE: return str; + default: + return str; } } @@ -34,6 +36,8 @@ std::string ParserClient::addAbstractionPrefix(const std::string& str, Abstracti return "pure virtual " + str; case ABSTRACTION_NONE: return str; + default: + return str; } } diff --git a/src/lib/data/search/SearchMatch.cpp b/src/lib/data/search/SearchMatch.cpp index a8b06e00..9d9e4852 100644 --- a/src/lib/data/search/SearchMatch.cpp +++ b/src/lib/data/search/SearchMatch.cpp @@ -29,7 +29,10 @@ std::string SearchMatch::getSearchTypeName(SearchType type) return "command"; case SEARCH_OPERATOR: return "operator"; + default: + return "none"; } + } std::string SearchMatch::searchMatchesToString(const std::vector& matches) diff --git a/src/lib_gui/qt/window/QtAboutLicense.cpp b/src/lib_gui/qt/window/QtAboutLicense.cpp index 3e86188d..0199c284 100644 --- a/src/lib_gui/qt/window/QtAboutLicense.cpp +++ b/src/lib_gui/qt/window/QtAboutLicense.cpp @@ -9,6 +9,7 @@ #include #include "licenses.h" +#include "isTrial.h" QtAboutLicense::QtAboutLicense(QWidget *parent) : QtSettingsWindow(parent) @@ -34,24 +35,28 @@ void QtAboutLicense::populateForm(QFormLayout* layout) { for(ThirdPartyLicense license : licenses3rdParties) { - QLabel* licenseName = new QLabel(); - licenseName->setText( QString::fromLatin1(license.name)); - QFont _font = licenseName->font(); - _font.setPixelSize(36); - licenseName->setFont(_font); - layout->addWidget(licenseName); + if( !(isTrial() && license.isNotInTrial) ) + { + QLabel* licenseName = new QLabel(); + licenseName->setText( QString::fromLatin1(license.name)); + QFont _font = licenseName->font(); + _font.setPixelSize(36); + licenseName->setFont(_font); + layout->addWidget(licenseName); - QLabel* licenseURL = new QLabel(); - licenseURL->setText(QString::fromLatin1("(Website)") - .arg(QString::fromLatin1(license.url))); - licenseURL->setOpenExternalLinks(true); - layout->addWidget(licenseURL); + QLabel* licenseURL = new QLabel(); + licenseURL->setText(QString::fromLatin1("(Website)") + .arg(QString::fromLatin1(license.url))); + licenseURL->setOpenExternalLinks(true); + layout->addWidget(licenseURL); + + QLabel* licenseText = new QLabel(); + licenseText->setFixedWidth(450); + licenseText->setWordWrap(true); + licenseText->setText(QString::fromLatin1(license.license)); + layout->addWidget(licenseText); + } - QLabel* licenseText = new QLabel(); - licenseText->setFixedWidth(450); - licenseText->setWordWrap(true); - licenseText->setText(QString::fromLatin1(license.license)); - layout->addWidget(licenseText); } } diff --git a/src/lib_gui/qt/window/QtMainWindow.cpp b/src/lib_gui/qt/window/QtMainWindow.cpp index 578ae9d5..9437397a 100644 --- a/src/lib_gui/qt/window/QtMainWindow.cpp +++ b/src/lib_gui/qt/window/QtMainWindow.cpp @@ -25,6 +25,7 @@ #include "utility/messaging/type/MessageWindowFocus.h" #include "utility/messaging/type/MessageZoom.h" #include "version.h" +#include "isTrial.h" std::string QtMainWindow::m_windowSettingsPath = "data/window_settings.ini"; @@ -407,16 +408,19 @@ void QtMainWindow::setupProjectMenu() QMenu *menu = new QMenu(tr("&Project"), this); menuBar()->addMenu(menu); - menu->addAction(tr("&New Project..."), this, SLOT(newProject()), QKeySequence::New); - menu->addAction(tr("&Open Project..."), this, SLOT(openProject()), QKeySequence::Open); - menu->addAction(tr("&Edit Project..."), this, SLOT(editProject())); + if(!isTrial()) + { + menu->addAction(tr("&New Project..."), this, SLOT(newProject()), QKeySequence::New); + menu->addAction(tr("&Open Project..."), this, SLOT(openProject()), QKeySequence::Open); + menu->addAction(tr("&Edit Project..."), this, SLOT(editProject())); - menu->addSeparator(); + menu->addSeparator(); - menu->addAction(tr("&Save Project"), this, SLOT(saveProject()), QKeySequence::Save); - menu->addAction(tr("Save Project as..."), this, SLOT(saveAsProject()), QKeySequence::SaveAs); + menu->addAction(tr("&Save Project"), this, SLOT(saveProject()), QKeySequence::Save); + menu->addAction(tr("Save Project as..."), this, SLOT(saveAsProject()), QKeySequence::SaveAs); - menu->addSeparator(); + menu->addSeparator(); + } QMenu *recentProjectMenu = new QMenu(tr("Recent Projects")); menu->addMenu(recentProjectMenu); @@ -480,16 +484,17 @@ void QtMainWindow::setupEditMenu() menu->addAction(tr("Redo"), this, SLOT(redo()), QKeySequence::Redo); menu->addSeparator(); - - menu->addAction(tr("&Refresh"), this, SLOT(refresh()), QKeySequence::Refresh); - - if (QSysInfo::windowsVersion() != QSysInfo::WV_None) + if(!isTrial()) { - menu->addAction(tr("&Force Refresh"), this, SLOT(forceRefresh()), QKeySequence(Qt::SHIFT + Qt::Key_F5)); - } - else - { - menu->addAction(tr("&Force Refresh"), this, SLOT(forceRefresh()), QKeySequence(Qt::SHIFT + Qt::CTRL + Qt::Key_R)); + menu->addAction(tr("&Refresh"), this, SLOT(refresh()), QKeySequence::Refresh); + if (QSysInfo::windowsVersion() != QSysInfo::WV_None) + { + menu->addAction(tr("&Force Refresh"), this, SLOT(forceRefresh()), QKeySequence(Qt::SHIFT + Qt::Key_F5)); + } + else + { + menu->addAction(tr("&Force Refresh"), this, SLOT(forceRefresh()), QKeySequence(Qt::SHIFT + Qt::CTRL + Qt::Key_R)); + } } menu->addAction(tr("&Find"), this, SLOT(find()), QKeySequence::Find); @@ -517,7 +522,11 @@ void QtMainWindow::setupHelpMenu() menu->addAction(tr("&About"), this, SLOT(about())); menu->addAction(tr("Licences"), this, SLOT(showLicenses())); - menu->addAction(tr("Preferences..."), this, SLOT(openSettings())); + if(!isTrial()) + { + menu->addAction(tr("Preferences..."), this, SLOT(openSettings())); + //Todo: Enter License Window + } } void QtMainWindow::setupShortcuts() diff --git a/src/lib_gui/qt/window/QtStartScreen.cpp b/src/lib_gui/qt/window/QtStartScreen.cpp index 9d24162a..0838c23d 100644 --- a/src/lib_gui/qt/window/QtStartScreen.cpp +++ b/src/lib_gui/qt/window/QtStartScreen.cpp @@ -10,6 +10,7 @@ #include "qt/utility/QtDeviceScaledPixmap.h" #include "qt/utility/utilityQt.h" +#include "isTrial.h" QtRecentProjectButton::QtRecentProjectButton(const QString &text, QWidget *parent) : QPushButton(text, parent) @@ -41,17 +42,20 @@ void QtStartScreen::setup() coatiLogoLabel->resize(coati_logo.width(), coati_logo.height()); coatiLogoLabel->move(30,10); - m_newProjectButton = new QPushButton("New Project", this); - m_newProjectButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac - m_newProjectButton->setGeometry(30, 495, 140, 30); - m_newProjectButton->setObjectName("projectButton"); - connect(m_newProjectButton, SIGNAL(clicked()), this, SLOT(handleNewProjectButton())); + if(!isTrial()) + { + m_newProjectButton = new QPushButton("New Project", this); + m_newProjectButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac + m_newProjectButton->setGeometry(30, 495, 140, 30); + m_newProjectButton->setObjectName("projectButton"); + connect(m_newProjectButton, SIGNAL(clicked()), this, SLOT(handleNewProjectButton())); - m_openProjectButton = new QPushButton("Open Project", this); - m_openProjectButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac - m_openProjectButton->setGeometry(30, 540, 140, 30); - m_openProjectButton->setObjectName("projectButton"); - connect(m_openProjectButton, SIGNAL(clicked()), this, SLOT(handleOpenProjectButton())); + m_openProjectButton = new QPushButton("Open Project", this); + m_openProjectButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac + m_openProjectButton->setGeometry(30, 540, 140, 30); + m_openProjectButton->setObjectName("projectButton"); + connect(m_openProjectButton, SIGNAL(clicked()), this, SLOT(handleOpenProjectButton())); + } QLabel* recentProjectsLabel = new QLabel("Recent Projects: ", this); recentProjectsLabel->setGeometry(300, 234, 300, 50); diff --git a/src/trial/isTrial.cpp b/src/trial/isTrial.cpp index 7ade7bf0..0873487c 100644 --- a/src/trial/isTrial.cpp +++ b/src/trial/isTrial.cpp @@ -1,6 +1,6 @@ #include "isTrial.h" -bool isTrail() +bool isTrial() { return true; }