Compare commits
34
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9550ea1fdc | ||
|
|
cad473c097 | ||
|
|
89264d97bb | ||
|
|
096291a6c4 | ||
|
|
1fcb241189 | ||
|
|
996b33b1fb | ||
|
|
fea26bfc60 | ||
|
|
6a3717b8c1 | ||
|
|
8b770b0c71 | ||
|
|
06255286ae | ||
|
|
8a13aebc3f | ||
|
|
5bfd0ecbbe | ||
|
|
e604c3b025 | ||
|
|
b683d7b2d6 | ||
|
|
dbcb8f449c | ||
|
|
592cc99cee | ||
|
|
4e18389d38 | ||
|
|
32f894422d | ||
|
|
b5d9d20bc9 | ||
|
|
cba0cfad65 | ||
|
|
ba3316008a | ||
|
|
8ca54f2091 | ||
|
|
2cf033d43a | ||
|
|
3430ed2a1b | ||
|
|
140d4a406a | ||
|
|
44cee3d130 | ||
|
|
5161455355 | ||
|
|
e7efff8843 | ||
|
|
7f867bf889 | ||
|
|
36c504d8a0 | ||
|
|
9560cc4ea6 | ||
|
|
6b31a43f75 | ||
|
|
b4c094e784 | ||
|
|
7227a47b49 |
@@ -94,6 +94,65 @@ $ git push --tags
|
||||
|
||||
### Changelog
|
||||
|
||||
#### 0.7.0.22
|
||||
released 2016-07-07
|
||||
|
||||
* Fixed detected global header search paths lost correct order and caused problems with #include_next directives
|
||||
* Fixed MaxOSX build crashed on launch due to unknown command line option passed
|
||||
* Removed 'Save Project' and 'Save Project As' actions from menu
|
||||
* Fixed indexer getting stuck at 'building caches' when indexing is interrupted
|
||||
* Fixed database not properly closed when errors appeared during indexing
|
||||
* Fixed autocompletions popup flickering while typing
|
||||
* Added resize grip to bottom right corner of every dialog window
|
||||
* Fixed 'paths don't exist' dialog window getting too big with lots of paths shown
|
||||
* Added context menu with 'back' and 'forward' actions available in all views
|
||||
* Removed Clang compiler warnings from console output
|
||||
* Added handling of project specific VS macros to VS solution parser
|
||||
|
||||
#### 0.7.0.0
|
||||
released 2016-06-15
|
||||
|
||||
* Updated to clang 3.8
|
||||
* Fixed crash in search autocompletion retrieval due to edge case in sorting
|
||||
* Fixed size policies in code view to avoid global scrollbar
|
||||
* Added full text search via search field: ?<query> for case-insensitive search, ??<query> for case-sensitive search
|
||||
* Made initialization for full text search lazy: done on first full text search
|
||||
* Defined full text search color in all color schemes
|
||||
* Increased code view performance by caching file IDs and paths
|
||||
* Added multithreaded indexing. Number of threads can be set in the Preferences UI, default is 4
|
||||
* Reworked graph node bundling to only distinguish defined and undefined nodes in each bucket
|
||||
* Made graph node sorting alphabetical and put bundles at end
|
||||
* Changed code view snippet sorting to always show definition on top
|
||||
* Fixed local symbols were not available within lambdas
|
||||
* Added settings for font family, font size and tab with to Preferences UI
|
||||
* Fixed VS solution parser issue with internal macros
|
||||
* Removed header extensions, all included files within the project paths are now analyzed
|
||||
* Fixed crash in sqlite when symbol name has special characters
|
||||
* Improved code view performance by reducing amount of initially open code files
|
||||
* Improved graph view performance through faster data retrieval and smarter structures
|
||||
* Increased aggregation click speed with faster edge id retrieval
|
||||
* Fixed png color profiles to avoid console warning: "libpng warning: iCCP: known incorrect sRGB profile"
|
||||
* Fixed graph edge drawn wrong when leaving from child node of smaller node
|
||||
* Fixed Sublime Text Plugin issue with wrong encoding
|
||||
* Randomized source file order for multithreaded analysis to increase performance
|
||||
* Show name of removed symbol when going back after refreshing
|
||||
* Fixed macro definition not connected to file
|
||||
* Fixed macro use not found in #ifdef, #ifndef, defined() and some expand cases
|
||||
* Removed back and forward steps for some graph and code view manipulations
|
||||
* Fixed code view style broken on Mac due to change of working directory when analyzing compilation database
|
||||
* Added database optimization step after indexing to reduce database size by ~25%
|
||||
* Fixed artifacts after graph view change by clearing view
|
||||
* Fixed autocompletion list highlights at wrong location for long names
|
||||
* Allow files and directories to be excluded from analysis in advanced settings for project setup
|
||||
* Added Qt gif plugin to Mac Release so that loader gif in status bar is visible
|
||||
* Added link to download page to start screen to remind users of updating once in a while
|
||||
* Check if compilation database still exists before refreshing
|
||||
* Added separate step for defining project name, project location and compiliation database to project setup
|
||||
* Explain that the project stays up-to-date with the compilation databes on refresh in project setup UI
|
||||
* Disregard source extensions when loading from compilation database
|
||||
* Removed error logs in name resolver
|
||||
* Added plugin for VIM: https://github.com/CoatiSoftware/vim-coati
|
||||
|
||||
#### 0.6.0.0
|
||||
released 2016-04-27
|
||||
|
||||
|
||||
@@ -2,16 +2,13 @@
|
||||
background-color: <color:code/background>;
|
||||
}
|
||||
|
||||
* {
|
||||
font-size: <setting:font_size>pt;
|
||||
}
|
||||
|
||||
#code_file {
|
||||
background-color: <color:code/snippet/background>;
|
||||
border: 2px solid <color:code/file/background>;
|
||||
border-radius: 12px;
|
||||
border-top-left-radius: 14px;
|
||||
border-top-right-radius: 14px;
|
||||
font-size: <setting:font_size>pt;
|
||||
padding-bottom: 7px;
|
||||
}
|
||||
|
||||
@@ -19,6 +16,7 @@
|
||||
background-color: <color:code/file/background>;
|
||||
border-top-left-radius: 7px;
|
||||
border-top-right-radius: 7px;
|
||||
font-size: <setting:font_size>pt;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
@@ -27,6 +25,7 @@
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
color: <color:code/file/title/text>;
|
||||
font-size: <setting:font_size>pt;
|
||||
padding: 2px 4px;
|
||||
margin: 1px 8px 3px;
|
||||
}
|
||||
@@ -52,10 +51,7 @@
|
||||
#code_file #code_snippet {
|
||||
background-color: <color:code/snippet/background>;
|
||||
border-top: 2px solid <color:code/file/background>;
|
||||
}
|
||||
|
||||
#code_file #code_snippet * {
|
||||
font-family: "<setting:font_name>";
|
||||
font-size: <setting:font_size>pt;
|
||||
}
|
||||
|
||||
#code_file #code_snippet[isFirst=true] {
|
||||
@@ -65,8 +61,10 @@
|
||||
|
||||
#code_file #code_snippet #scope_name, #code_file #code_snippet #dots {
|
||||
background-color: <color:code/snippet/title/background>;
|
||||
color: <color:code/snippet/title/text>;
|
||||
border: none;
|
||||
color: <color:code/snippet/title/text>;
|
||||
font-family: "<setting:font_name>";
|
||||
font-size: <setting:font_size>pt;
|
||||
}
|
||||
|
||||
#code_file #code_snippet #scope_name:hover {
|
||||
@@ -88,11 +86,15 @@
|
||||
background-color: <color:code/snippet/line_number/background>;
|
||||
border: none;
|
||||
color: <color:code/snippet/line_number/text>;
|
||||
font-family: "<setting:font_name>";
|
||||
font-size: <setting:font_size>pt;
|
||||
}
|
||||
|
||||
#code_area {
|
||||
background-color: transparent;
|
||||
color: <color:code/snippet/syntax/normal>;
|
||||
font-family: "<setting:font_name>";
|
||||
font-size: <setting:font_size>pt;
|
||||
}
|
||||
|
||||
#code_file #maximize_button, #code_file #snippet_button, #code_file #minimize_button {
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
color: black;
|
||||
font-size: 16pt;
|
||||
font-weight: bold;
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
#versionLabel {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
@@ -1 +1 @@
|
||||
%windir%\system32\msiexec.exe /I{8C114E1D-F40F-4197-9184-F6E91147E966}
|
||||
%windir%\system32\msiexec.exe /I{E6E16577-C547-4A66-8202-AB30A02DDBC2}
|
||||
@@ -1 +1 @@
|
||||
%windir%\system32\msiexec.exe /I{173EB0F5-BABB-4C7A-AB43-B767FDC55810}
|
||||
%windir%\system32\msiexec.exe /I{225E11DF-20A0-4AE0-AD5C-00944A9E3D71}
|
||||
@@ -55,5 +55,3 @@ TextAccess.cpp WARNING: Line numbers start with one, is 0
|
||||
TextAccess.cpp WARNING: Line numbers start with one, is 0
|
||||
TokenLocationCollection.cpp ERROR: TokenLocation has wrong boundaries: file.c 2:3 2:1
|
||||
TokenLocationCollection.cpp ERROR: TokenLocation has wrong boundaries: file.c 4:1 1:10
|
||||
SolutionParserVisualStudio.cpp INFO: Found 24 additional include paths
|
||||
SolutionParserVisualStudio.cpp INFO: Found 450 code files
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
string(REGEX REPLACE "^([0-9]+)\\..*" "\\1" VERSION_MAJOR "${GIT_VERSION_NUMBER}")
|
||||
message(STATUS "Get Public Key for Coati version: ${VERSION_MAJOR}")
|
||||
|
||||
message(STATUS "${CMAKE_SOURCE_DIR}/setup/RSA_keys/public-${VERSION_MAJOR}.pem")
|
||||
|
||||
set(pubKeyFile "${CMAKE_SOURCE_DIR}/setup/RSA_keys/public-${VERSION_MAJOR}.pem")
|
||||
# message(STATUS "file: ${pubKeyFile}")
|
||||
|
||||
@@ -13,7 +15,7 @@ if(EXISTS ${pubKeyFile})
|
||||
STRING(REGEX REPLACE "\n" "\\\\n\"\n\t\"" KEY "${KEY}")
|
||||
# message(STATUS "key: ${KEY}")
|
||||
else()
|
||||
message(WARNING "public keyfile for this version of Coati")
|
||||
message(WARNING "public keyfile for this version of Coati not found")
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
|
||||
@@ -501,6 +501,12 @@
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_8C02107F94A64029901B8B190E8C6BAC"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_8E2479A7DD6C48F88B7BCC1567A53892"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
@@ -2776,6 +2782,26 @@
|
||||
"IsDependency" = "11:FALSE"
|
||||
"IsolateTo" = "8:"
|
||||
}
|
||||
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_8C02107F94A64029901B8B190E8C6BAC"
|
||||
{
|
||||
"SourcePath" = "8:..\\..\\..\\..\\bin\\app\\data\\gui\\window\\size_grip.png"
|
||||
"TargetName" = "8:size_grip.png"
|
||||
"Tag" = "8:"
|
||||
"Folder" = "8:_56A98FDB83CE48C489B793615E24C057"
|
||||
"Condition" = "8:"
|
||||
"Transitive" = "11:FALSE"
|
||||
"Vital" = "11:TRUE"
|
||||
"ReadOnly" = "11:FALSE"
|
||||
"Hidden" = "11:FALSE"
|
||||
"System" = "11:FALSE"
|
||||
"Permanent" = "11:FALSE"
|
||||
"SharedLegacy" = "11:FALSE"
|
||||
"PackageAs" = "3:1"
|
||||
"Register" = "3:1"
|
||||
"Exclude" = "11:FALSE"
|
||||
"IsDependency" = "11:FALSE"
|
||||
"IsolateTo" = "8:"
|
||||
}
|
||||
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_8E2479A7DD6C48F88B7BCC1567A53892"
|
||||
{
|
||||
"SourcePath" = "8:..\\..\\..\\..\\bin\\app\\data\\projects\\tutorial\\src\\code_tutorial_2.h"
|
||||
@@ -4284,15 +4310,15 @@
|
||||
{
|
||||
"Name" = "8:Microsoft Visual Studio"
|
||||
"ProductName" = "8:Coati"
|
||||
"ProductCode" = "8:{8C114E1D-F40F-4197-9184-F6E91147E966}"
|
||||
"PackageCode" = "8:{AD79B9D4-D47B-4576-82F8-685D112E06A2}"
|
||||
"ProductCode" = "8:{E6E16577-C547-4A66-8202-AB30A02DDBC2}"
|
||||
"PackageCode" = "8:{55D5307B-C6AB-4E1D-A512-239F7E164FCD}"
|
||||
"UpgradeCode" = "8:{CFF09D53-87AF-4241-960D-98C21ED9D358}"
|
||||
"AspNetVersion" = "8:4.0.30319.0"
|
||||
"RestartWWWService" = "11:FALSE"
|
||||
"RemovePreviousVersions" = "11:TRUE"
|
||||
"DetectNewerInstalledVersion" = "11:TRUE"
|
||||
"InstallAllUsers" = "11:FALSE"
|
||||
"ProductVersion" = "8:0.7.0000"
|
||||
"ProductVersion" = "8:0.7.0022"
|
||||
"Manufacturer" = "8:Coati Software"
|
||||
"ARPHELPTELEPHONE" = "8:"
|
||||
"ARPHELPLINK" = "8:www.coati.io/support"
|
||||
|
||||
@@ -219,6 +219,12 @@
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_41D7E42E67AA4615BEC19409547F70A2"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_4400372852214CC588823F7A1A9F5F5D"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
@@ -874,7 +880,7 @@
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_UNDEFINED"
|
||||
"OwnerKey" = "8:_C84BE68F0D9E42D3B9BD9C8A53DF049A"
|
||||
"OwnerKey" = "8:_FB29EAD658C3497D9AC46ADE92D33C83"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
@@ -886,7 +892,7 @@
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_UNDEFINED"
|
||||
"OwnerKey" = "8:_FB29EAD658C3497D9AC46ADE92D33C83"
|
||||
"OwnerKey" = "8:_C84BE68F0D9E42D3B9BD9C8A53DF049A"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
}
|
||||
@@ -1868,6 +1874,26 @@
|
||||
"IsDependency" = "11:FALSE"
|
||||
"IsolateTo" = "8:"
|
||||
}
|
||||
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_41D7E42E67AA4615BEC19409547F70A2"
|
||||
{
|
||||
"SourcePath" = "8:..\\..\\..\\..\\bin\\app\\data\\gui\\window\\size_grip.png"
|
||||
"TargetName" = "8:size_grip.png"
|
||||
"Tag" = "8:"
|
||||
"Folder" = "8:_991DBD2EDC144CE79F23005FB99BF9AF"
|
||||
"Condition" = "8:"
|
||||
"Transitive" = "11:FALSE"
|
||||
"Vital" = "11:TRUE"
|
||||
"ReadOnly" = "11:FALSE"
|
||||
"Hidden" = "11:FALSE"
|
||||
"System" = "11:FALSE"
|
||||
"Permanent" = "11:FALSE"
|
||||
"SharedLegacy" = "11:FALSE"
|
||||
"PackageAs" = "3:1"
|
||||
"Register" = "3:1"
|
||||
"Exclude" = "11:FALSE"
|
||||
"IsDependency" = "11:FALSE"
|
||||
"IsolateTo" = "8:"
|
||||
}
|
||||
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_4400372852214CC588823F7A1A9F5F5D"
|
||||
{
|
||||
"SourcePath" = "8:..\\..\\..\\..\\bin\\app\\Release\\Qt5Gui.dll"
|
||||
@@ -4313,15 +4339,15 @@
|
||||
{
|
||||
"Name" = "8:Microsoft Visual Studio"
|
||||
"ProductName" = "8:Coati Trial"
|
||||
"ProductCode" = "8:{173EB0F5-BABB-4C7A-AB43-B767FDC55810}"
|
||||
"PackageCode" = "8:{146FC1DF-7415-48DB-89C9-78CF834552C7}"
|
||||
"ProductCode" = "8:{225E11DF-20A0-4AE0-AD5C-00944A9E3D71}"
|
||||
"PackageCode" = "8:{AFEFFBA8-DE40-4FD1-84A9-ACE53FE97555}"
|
||||
"UpgradeCode" = "8:{00D35BB8-F11C-4179-9962-47B3D55E412C}"
|
||||
"AspNetVersion" = "8:4.0.30319.0"
|
||||
"RestartWWWService" = "11:FALSE"
|
||||
"RemovePreviousVersions" = "11:TRUE"
|
||||
"DetectNewerInstalledVersion" = "11:TRUE"
|
||||
"InstallAllUsers" = "11:FALSE"
|
||||
"ProductVersion" = "8:0.7.0000"
|
||||
"ProductVersion" = "8:0.7.0022"
|
||||
"Manufacturer" = "8:Coati Software"
|
||||
"ARPHELPTELEPHONE" = "8:"
|
||||
"ARPHELPLINK" = "8:www.coati.io/support"
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string></string>
|
||||
<string>@GIT_VERSION_NUMBER@</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>LSRequiresCarbon</key>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string></string>
|
||||
<string>@GIT_VERSION_NUMBER@</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>LSRequiresCarbon</key>
|
||||
|
||||
@@ -46,7 +46,7 @@ CommandLineParser::CommandLineParser(int argc, char** argv, const std::string& v
|
||||
all.add(desc).add(hidden_desc);
|
||||
|
||||
po::variables_map vm;
|
||||
po::store(po::command_line_parser(argc,argv).options(all).positional(positionalOption).run(), vm);
|
||||
po::store(po::command_line_parser(argc,argv).options(all).positional(positionalOption).allow_unregistered().run(), vm);
|
||||
po::notify(vm);
|
||||
|
||||
if (vm.count("help"))
|
||||
|
||||
+48
-26
@@ -1,5 +1,6 @@
|
||||
#include "Application.h"
|
||||
|
||||
#include "utility/file/FileSystem.h"
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/messaging/MessageQueue.h"
|
||||
#include "utility/messaging/type/MessageActivateNodes.h"
|
||||
@@ -7,6 +8,7 @@
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/messaging/type/MessageShowStartScreen.h"
|
||||
#include "utility/scheduling/TaskScheduler.h"
|
||||
#include "utility/tracing.h"
|
||||
#include "utility/UserPaths.h"
|
||||
#include "utility/Version.h"
|
||||
|
||||
@@ -200,18 +202,6 @@ void Application::refreshProject()
|
||||
}
|
||||
}
|
||||
|
||||
void Application::saveProject(const FilePath& projectSettingsFilePath)
|
||||
{
|
||||
if (!m_project->save(projectSettingsFilePath))
|
||||
{
|
||||
LOG_ERROR("No Project Settings File defined");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageStatus("Project saved").dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
void Application::handleMessage(MessageActivateWindow* message)
|
||||
{
|
||||
if (m_hasGUI)
|
||||
@@ -231,6 +221,8 @@ void Application::handleMessage(MessageFinishedParsing* message)
|
||||
|
||||
void Application::handleMessage(MessageLoadProject* message)
|
||||
{
|
||||
TRACE("app load project");
|
||||
|
||||
FilePath projectSettingsFilePath(message->projectSettingsFilePath);
|
||||
if (projectSettingsFilePath.empty())
|
||||
{
|
||||
@@ -245,17 +237,50 @@ void Application::handleMessage(MessageLoadProject* message)
|
||||
{
|
||||
if (m_hasGUI)
|
||||
{
|
||||
std::vector<std::string> options;
|
||||
options.push_back("Yes");
|
||||
options.push_back("No");
|
||||
int result = m_mainView->confirm(
|
||||
"Some settings were changed, the project needs to be fully reindexed. "
|
||||
"Do you want to reindex the project?", options);
|
||||
FilePath path = projectSettingsFilePath;
|
||||
FilePath oldPath = m_project->getProjectSettingsFilePath();
|
||||
|
||||
if (result == 1)
|
||||
if (oldPath.exists() && oldPath != path)
|
||||
{
|
||||
m_project->load(projectSettingsFilePath);
|
||||
return;
|
||||
std::vector<std::string> options;
|
||||
options.push_back("Yes");
|
||||
options.push_back("No");
|
||||
int result = m_mainView->confirm(
|
||||
"You changed the project location. The project file (.coatiproject) and the database file (.coatidb) will "
|
||||
"be moved to the new location. Do you want to keep a copy of the files in the previous location?"
|
||||
, options);
|
||||
|
||||
FilePath dbPath = FilePath(path).replaceExtension("coatidb");
|
||||
FilePath olddbPath = FilePath(oldPath).replaceExtension("coatidb");
|
||||
|
||||
m_project = Project::create(m_storageCache.get());
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
FileSystem::copyFile(olddbPath, dbPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
FileSystem::remove(oldPath);
|
||||
FileSystem::rename(olddbPath, dbPath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<std::string> options;
|
||||
options.push_back("Yes");
|
||||
options.push_back("No");
|
||||
int result = m_mainView->confirm(
|
||||
"Some settings were changed, the project needs to be fully reindexed. "
|
||||
"Do you want to reindex the project?", options);
|
||||
|
||||
if (result == 1)
|
||||
{
|
||||
m_project->load(projectSettingsFilePath);
|
||||
updateRecentProjects(projectSettingsFilePath);
|
||||
m_mainView->setTitle("Coati - " + projectSettingsFilePath.fileName());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,6 +304,8 @@ void Application::handleMessage(MessageLoadProject* message)
|
||||
|
||||
void Application::handleMessage(MessageRefresh* message)
|
||||
{
|
||||
TRACE("app refresh");
|
||||
|
||||
loadSettings();
|
||||
|
||||
if (message->uiOnly)
|
||||
@@ -296,11 +323,6 @@ void Application::handleMessage(MessageRefresh* message)
|
||||
}
|
||||
}
|
||||
|
||||
void Application::handleMessage(MessageSaveProject* message)
|
||||
{
|
||||
saveProject(message->projectSettingsFilePath);
|
||||
}
|
||||
|
||||
void Application::startMessagingAndScheduling()
|
||||
{
|
||||
TaskScheduler::getInstance()->startSchedulerLoopThreaded();
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "utility/messaging/type/MessageFinishedParsing.h"
|
||||
#include "utility/messaging/type/MessageLoadProject.h"
|
||||
#include "utility/messaging/type/MessageRefresh.h"
|
||||
#include "utility/messaging/type/MessageSaveProject.h"
|
||||
|
||||
class IDECommunicationController;
|
||||
class NetworkFactory;
|
||||
@@ -24,7 +23,6 @@ class Application
|
||||
, public MessageListener<MessageFinishedParsing>
|
||||
, public MessageListener<MessageLoadProject>
|
||||
, public MessageListener<MessageRefresh>
|
||||
, public MessageListener<MessageSaveProject>
|
||||
{
|
||||
public:
|
||||
static std::shared_ptr<Application> create(const Version& version, ViewFactory* viewFactory, NetworkFactory* networkFactory);
|
||||
@@ -36,7 +34,6 @@ public:
|
||||
void createAndLoadProject(const FilePath& projectSettingsFilePath);
|
||||
void loadProject(const FilePath& projectSettingsFilePath);
|
||||
void refreshProject();
|
||||
void saveProject(const FilePath& projectSettingsFilePath);
|
||||
bool hasGUI();
|
||||
|
||||
private:
|
||||
@@ -46,7 +43,6 @@ private:
|
||||
virtual void handleMessage(MessageFinishedParsing* message);
|
||||
virtual void handleMessage(MessageLoadProject* message);
|
||||
virtual void handleMessage(MessageRefresh* message);
|
||||
virtual void handleMessage(MessageSaveProject* message);
|
||||
|
||||
void startMessagingAndScheduling();
|
||||
|
||||
|
||||
@@ -234,6 +234,7 @@ add_files(
|
||||
utility/messaging/type/MessageAutoRefreshChanged.h
|
||||
utility/messaging/type/MessageChangeFileView.h
|
||||
utility/messaging/type/MessageClearErrorCount.h
|
||||
utility/messaging/type/MessageColorSchemeTest.h
|
||||
utility/messaging/type/MessageDeactivateEdge.h
|
||||
utility/messaging/type/MessageDispatchWhenLicenseValid.h
|
||||
utility/messaging/type/MessageEnteredLicense.h
|
||||
@@ -254,7 +255,6 @@ add_files(
|
||||
utility/messaging/type/MessageRedo.h
|
||||
utility/messaging/type/MessageRefresh.h
|
||||
utility/messaging/type/MessageResetZoom.h
|
||||
utility/messaging/type/MessageSaveProject.h
|
||||
utility/messaging/type/MessageScrollCode.h
|
||||
utility/messaging/type/MessageSearch.h
|
||||
utility/messaging/type/MessageSearchAutocomplete.h
|
||||
@@ -316,6 +316,8 @@ add_files(
|
||||
utility/ScopedSwitcher.h
|
||||
utility/TimePoint.cpp
|
||||
utility/TimePoint.h
|
||||
utility/tracing.cpp
|
||||
utility/tracing.h
|
||||
utility/types.h
|
||||
utility/UserPaths.cpp
|
||||
utility/UserPaths.h
|
||||
|
||||
+3
-35
@@ -91,36 +91,6 @@ Project::ProjectState Project::reload()
|
||||
return m_state;
|
||||
}
|
||||
|
||||
bool Project::save(const FilePath& projectSettingsFile)
|
||||
{
|
||||
bool differentLocation = (projectSettingsFile != m_projectSettingsFilepath);
|
||||
if (!projectSettingsFile.empty())
|
||||
{
|
||||
setProjectSettingsFilePath(projectSettingsFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
differentLocation = false;
|
||||
}
|
||||
|
||||
if (m_projectSettingsFilepath.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ProjectSettings settings;
|
||||
settings.load(m_projectSettingsFilepath);
|
||||
|
||||
if (differentLocation || settings != *ProjectSettings::getInstance().get())
|
||||
{
|
||||
ProjectSettings::getInstance()->save(m_projectSettingsFilepath);
|
||||
|
||||
LOG_INFO_STREAM(<< "ProjectSettings saved to file: " << m_projectSettingsFilepath.str());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Project::clearStorage()
|
||||
{
|
||||
if (m_state == PROJECT_OUTVERSIONED)
|
||||
@@ -291,14 +261,12 @@ Parser::Arguments Project::getParserArguments() const
|
||||
if (projSettings->getUseSourcePathsForHeaderSearch())
|
||||
{
|
||||
std::vector<FilePath> headerSearchSubPaths;
|
||||
for (FilePath p : projSettings->getAbsoluteHeaderSearchPaths())
|
||||
for (FilePath p : projSettings->getSourcePaths())
|
||||
{
|
||||
std::vector<FilePath> tempPaths = FileSystem::getSubDirectories(p);
|
||||
headerSearchSubPaths.insert( headerSearchSubPaths.end(), tempPaths.begin(), tempPaths.end() );
|
||||
utility::append(headerSearchSubPaths, FileSystem::getSubDirectories(p));
|
||||
}
|
||||
|
||||
std::unique(headerSearchSubPaths.begin(),headerSearchSubPaths.end());
|
||||
utility::append(args.systemHeaderSearchPaths, headerSearchSubPaths);
|
||||
utility::append(args.systemHeaderSearchPaths, utility::unique(headerSearchSubPaths));
|
||||
}
|
||||
|
||||
utility::append(args.frameworkSearchPaths, projSettings->getAbsoluteFrameworkSearchPaths());
|
||||
|
||||
@@ -31,8 +31,6 @@ public:
|
||||
ProjectState load(const FilePath& projectSettingsFile);
|
||||
ProjectState reload();
|
||||
|
||||
bool save(const FilePath& projectSettingsFile);
|
||||
|
||||
void clearStorage();
|
||||
|
||||
void logStats() const;
|
||||
|
||||
@@ -38,6 +38,8 @@ ViewFactory* ComponentFactory::getViewFactory() const
|
||||
std::shared_ptr<Component> ComponentFactory::createCodeComponent(ViewLayout* viewLayout)
|
||||
{
|
||||
std::shared_ptr<CodeView> view = m_viewFactory->createCodeView(viewLayout);
|
||||
view->createOverlay();
|
||||
|
||||
std::shared_ptr<CodeController> controller = std::make_shared<CodeController>(m_storageAccess);
|
||||
|
||||
return std::make_shared<Component>(view, controller);
|
||||
@@ -53,6 +55,8 @@ std::shared_ptr<Component> ComponentFactory::createFeatureComponent()
|
||||
std::shared_ptr<Component> ComponentFactory::createGraphComponent(ViewLayout* viewLayout)
|
||||
{
|
||||
std::shared_ptr<View> view = m_viewFactory->createGraphView(viewLayout);
|
||||
view->createOverlay();
|
||||
|
||||
std::shared_ptr<GraphController> controller = std::make_shared<GraphController>(m_storageAccess);
|
||||
|
||||
return std::make_shared<Component>(view, controller);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/text/TextAccess.h"
|
||||
#include "utility/tracing.h"
|
||||
#include "utility/utility.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
@@ -24,10 +25,13 @@ CodeController::~CodeController()
|
||||
{
|
||||
}
|
||||
|
||||
const uint CodeController::s_lineRadius = 2;
|
||||
|
||||
void CodeController::handleMessage(MessageActivateAll* message)
|
||||
{
|
||||
TRACE("code all");
|
||||
|
||||
CodeView* view = getView();
|
||||
view->showOverlay();
|
||||
|
||||
std::vector<ErrorInfo> errors;
|
||||
m_collection = m_storageAccess->getErrorTokenLocations(&errors);
|
||||
std::vector<CodeSnippetParams> snippets = getSnippetsForCollection(m_collection);
|
||||
@@ -79,7 +83,6 @@ void CodeController::handleMessage(MessageActivateAll* message)
|
||||
|
||||
snippets.insert(snippets.begin(), statsSnippet);
|
||||
|
||||
CodeView* view = getView();
|
||||
view->clear();
|
||||
view->setErrorInfos(errors);
|
||||
view->showCodeSnippets(snippets, std::vector<Id>());
|
||||
@@ -95,7 +98,10 @@ void CodeController::handleMessage(MessageActivateLocalSymbols* message)
|
||||
|
||||
void CodeController::handleMessage(MessageActivateTokens* message)
|
||||
{
|
||||
TRACE("code activate");
|
||||
|
||||
CodeView* view = getView();
|
||||
view->showOverlay();
|
||||
|
||||
if (!message->keepContent())
|
||||
{
|
||||
@@ -150,6 +156,8 @@ void CodeController::handleMessage(MessageActivateTokens* message)
|
||||
|
||||
void CodeController::handleMessage(MessageChangeFileView* message)
|
||||
{
|
||||
TRACE("code change file");
|
||||
|
||||
CodeView* view = getView();
|
||||
|
||||
switch (message->state)
|
||||
@@ -161,6 +169,7 @@ void CodeController::handleMessage(MessageChangeFileView* message)
|
||||
case MessageChangeFileView::FILE_SNIPPETS:
|
||||
if (message->needsData)
|
||||
{
|
||||
view->showOverlay();
|
||||
view->addCodeSnippets(getSnippetsForFile(
|
||||
m_collection->getTokenLocationFileByPath(message->filePath), !message->showErrors), false);
|
||||
}
|
||||
@@ -170,6 +179,8 @@ void CodeController::handleMessage(MessageChangeFileView* message)
|
||||
case MessageChangeFileView::FILE_MAXIMIZED:
|
||||
if (message->needsData)
|
||||
{
|
||||
view->showOverlay();
|
||||
|
||||
CodeSnippetParams params;
|
||||
params.startLineNumber = 1;
|
||||
params.refCount = -1;
|
||||
@@ -237,11 +248,15 @@ void CodeController::handleMessage(MessageScrollCode* message)
|
||||
|
||||
void CodeController::handleMessage(MessageShowErrors* message)
|
||||
{
|
||||
TRACE("code errors");
|
||||
|
||||
CodeView* view = getView();
|
||||
view->showOverlay();
|
||||
|
||||
std::vector<ErrorInfo> errors;
|
||||
m_collection = m_storageAccess->getErrorTokenLocations(&errors);
|
||||
std::vector<CodeSnippetParams> snippets = getSnippetsForCollection(m_collection);
|
||||
|
||||
CodeView* view = getView();
|
||||
view->clear();
|
||||
view->setErrorInfos(errors);
|
||||
view->showCodeSnippets(snippets, std::vector<Id>());
|
||||
@@ -251,7 +266,10 @@ void CodeController::handleMessage(MessageShowErrors* message)
|
||||
|
||||
void CodeController::handleMessage(MessageSearchFullText* message)
|
||||
{
|
||||
TRACE("code fulltext");
|
||||
|
||||
CodeView* view = getView();
|
||||
view->showOverlay();
|
||||
view->clear();
|
||||
|
||||
m_collection = m_storageAccess->getFullTextSearchLocations(message->searchTerm, message->caseSensitive);
|
||||
@@ -262,6 +280,8 @@ void CodeController::handleMessage(MessageSearchFullText* message)
|
||||
|
||||
void CodeController::handleMessage(MessageShowScope* message)
|
||||
{
|
||||
TRACE("code scope");
|
||||
|
||||
std::shared_ptr<TokenLocationCollection> collection =
|
||||
m_storageAccess->getTokenLocationsForLocationIds(std::vector<Id>(1, message->scopeLocationId));
|
||||
|
||||
@@ -328,6 +348,8 @@ void CodeController::showContents(MessageBase* message)
|
||||
std::vector<CodeSnippetParams> CodeController::getSnippetsForActiveTokenLocations(
|
||||
const TokenLocationCollection* collection, Id declarationId
|
||||
) const {
|
||||
TRACE();
|
||||
|
||||
std::vector<CodeSnippetParams> snippets;
|
||||
size_t definitionFileCount = 0;
|
||||
size_t declarationFileCount = 0;
|
||||
@@ -429,6 +451,8 @@ std::vector<CodeSnippetParams> CodeController::getSnippetsForFile(
|
||||
std::shared_ptr<TokenLocationFile> activeTokenLocations, bool addTokenLocations
|
||||
) const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::shared_ptr<TextAccess> textAccess = m_storageAccess->getFileContent(activeTokenLocations->getFilePath());
|
||||
std::shared_ptr<TokenLocationFile> scopeLocations
|
||||
= std::make_shared<TokenLocationFile>(activeTokenLocations->getFilePath().str());
|
||||
@@ -713,6 +737,8 @@ std::vector<std::string> CodeController::getProjectDescription(TokenLocationFile
|
||||
|
||||
void CodeController::addModificationTimes(std::vector<CodeSnippetParams>& snippets) const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::vector<FilePath> filePaths;
|
||||
for (const CodeSnippetParams& snippet : snippets)
|
||||
{
|
||||
|
||||
@@ -46,8 +46,6 @@ public:
|
||||
~CodeController();
|
||||
|
||||
private:
|
||||
static const uint s_lineRadius;
|
||||
|
||||
virtual void handleMessage(MessageActivateAll* message);
|
||||
virtual void handleMessage(MessageActivateLocalSymbols* message);
|
||||
virtual void handleMessage(MessageActivateTokens* message);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "utility/messaging/type/MessageActivateAll.h"
|
||||
#include "utility/messaging/type/MessageActivateTokens.h"
|
||||
#include "utility/messaging/type/MessageChangeFileView.h"
|
||||
#include "utility/messaging/type/MessageColorSchemeTest.h"
|
||||
#include "utility/messaging/type/MessageRefresh.h"
|
||||
#include "utility/messaging/type/MessageShowErrors.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
@@ -114,21 +115,34 @@ void FeatureController::handleMessage(MessageSearch* message)
|
||||
|
||||
for (const SearchMatch& match : matches)
|
||||
{
|
||||
if (match.searchType == SearchMatch::SEARCH_COMMAND &&
|
||||
match.getFullName() == SearchMatch::getCommandName(SearchMatch::COMMAND_ALL))
|
||||
if (match.searchType == SearchMatch::SEARCH_COMMAND)
|
||||
{
|
||||
MessageActivateAll msg;
|
||||
msg.setIsReplayed(message->isReplayed());
|
||||
msg.dispatchImmediately();
|
||||
return;
|
||||
}
|
||||
else if (match.searchType == SearchMatch::SEARCH_COMMAND &&
|
||||
match.getFullName() == SearchMatch::getCommandName(SearchMatch::COMMAND_ERROR))
|
||||
{
|
||||
MessageShowErrors msg(ErrorCountInfo(-1, 0));
|
||||
msg.setIsReplayed(message->isReplayed());
|
||||
msg.dispatchImmediately();
|
||||
return;
|
||||
SearchMatch::CommandType type = SearchMatch::getCommandType(match.getFullName());
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case SearchMatch::COMMAND_ALL:
|
||||
{
|
||||
MessageActivateAll msg;
|
||||
msg.setIsReplayed(message->isReplayed());
|
||||
msg.dispatchImmediately();
|
||||
return;
|
||||
}
|
||||
|
||||
case SearchMatch::COMMAND_ERROR:
|
||||
{
|
||||
MessageShowErrors msg(ErrorCountInfo(-1, 0));
|
||||
msg.setIsReplayed(message->isReplayed());
|
||||
msg.dispatchImmediately();
|
||||
return;
|
||||
}
|
||||
|
||||
case SearchMatch::COMMAND_COLOR_SCHEME_TEST:
|
||||
{
|
||||
MessageColorSchemeTest().dispatchImmediately();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <set>
|
||||
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/tracing.h"
|
||||
#include "utility/utility.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
@@ -23,10 +24,14 @@ GraphController::~GraphController()
|
||||
|
||||
void GraphController::handleMessage(MessageActivateAll* message)
|
||||
{
|
||||
TRACE("graph all");
|
||||
|
||||
getView()->showOverlay();
|
||||
|
||||
m_activeNodeIds.clear();
|
||||
m_activeEdgeIds.clear();
|
||||
|
||||
createDummyGraphForTokenIds(std::vector<Id>(), m_storageAccess->getGraphForAll());
|
||||
createDummyGraphForTokenIdsAndSetActiveAndVisibility(std::vector<Id>(), m_storageAccess->getGraphForAll());
|
||||
|
||||
bundleNodesByType();
|
||||
|
||||
@@ -38,6 +43,10 @@ void GraphController::handleMessage(MessageActivateAll* message)
|
||||
|
||||
void GraphController::handleMessage(MessageActivateTokens* message)
|
||||
{
|
||||
TRACE("graph activate");
|
||||
|
||||
getView()->showOverlay();
|
||||
|
||||
if (message->isEdge || message->keepContent())
|
||||
{
|
||||
m_activeEdgeIds = message->tokenIds;
|
||||
@@ -66,7 +75,7 @@ void GraphController::handleMessage(MessageActivateTokens* message)
|
||||
|
||||
std::shared_ptr<Graph> graph = m_storageAccess->getGraphForActiveTokenIds(tokenIds);
|
||||
|
||||
createDummyGraphForTokenIds(tokenIds, graph);
|
||||
createDummyGraphForTokenIdsAndSetActiveAndVisibility(tokenIds, graph);
|
||||
|
||||
if (m_activeNodeIds.size() == 1)
|
||||
{
|
||||
@@ -192,6 +201,8 @@ void GraphController::clear()
|
||||
|
||||
void GraphController::createDummyGraphForTokenIds(const std::vector<Id>& tokenIds, const std::shared_ptr<Graph> graph)
|
||||
{
|
||||
TRACE();
|
||||
|
||||
GraphView* view = getView();
|
||||
if (!view)
|
||||
{
|
||||
@@ -199,8 +210,6 @@ void GraphController::createDummyGraphForTokenIds(const std::vector<Id>& tokenId
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<Id> expandedNodeIds = getExpandedNodeIds();
|
||||
|
||||
m_dummyEdges.clear();
|
||||
m_dummyGraphNodes.clear();
|
||||
|
||||
@@ -242,14 +251,22 @@ void GraphController::createDummyGraphForTokenIds(const std::vector<Id>& tokenId
|
||||
|
||||
m_dummyNodes = dummyNodes;
|
||||
|
||||
m_graph = graph;
|
||||
}
|
||||
|
||||
void GraphController::createDummyGraphForTokenIdsAndSetActiveAndVisibility(
|
||||
const std::vector<Id>& tokenIds, const std::shared_ptr<Graph> graph
|
||||
){
|
||||
std::vector<Id> expandedNodeIds = getExpandedNodeIds();
|
||||
|
||||
createDummyGraphForTokenIds(tokenIds, graph);
|
||||
|
||||
bool noActive = setActive(tokenIds);
|
||||
|
||||
autoExpandActiveNode(tokenIds);
|
||||
setExpandedNodeIds(expandedNodeIds);
|
||||
|
||||
setVisibility(noActive);
|
||||
|
||||
m_graph = graph;
|
||||
}
|
||||
|
||||
std::shared_ptr<DummyNode> GraphController::createDummyNodeTopDown(Node* node, Id parentId)
|
||||
@@ -361,6 +378,8 @@ void GraphController::autoExpandActiveNode(const std::vector<Id>& activeTokenIds
|
||||
|
||||
bool GraphController::setActive(const std::vector<Id>& activeTokenIds)
|
||||
{
|
||||
TRACE();
|
||||
|
||||
bool noActive = activeTokenIds.size() == 0;
|
||||
if (activeTokenIds.size() > 0)
|
||||
{
|
||||
@@ -401,6 +420,8 @@ bool GraphController::setActive(const std::vector<Id>& activeTokenIds)
|
||||
|
||||
void GraphController::setVisibility(bool noActive)
|
||||
{
|
||||
TRACE();
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
{
|
||||
removeImplicitChildrenRecursive(node.get());
|
||||
@@ -411,6 +432,8 @@ void GraphController::setVisibility(bool noActive)
|
||||
|
||||
void GraphController::setActiveAndVisibility(const std::vector<Id>& activeTokenIds)
|
||||
{
|
||||
TRACE();
|
||||
|
||||
setVisibility(setActive(activeTokenIds));
|
||||
}
|
||||
|
||||
@@ -519,6 +542,8 @@ void GraphController::setNodeVisibilityRecursiveTopDown(DummyNode* node, bool pa
|
||||
|
||||
void GraphController::bundleNodes()
|
||||
{
|
||||
TRACE();
|
||||
|
||||
// evaluate top level nodes
|
||||
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
{
|
||||
@@ -714,7 +739,9 @@ void GraphController::bundleNodesAndEdgesMatching(
|
||||
}
|
||||
|
||||
DummyNode* firstNode = bundleNode->bundledNodes[0].get();
|
||||
bundleNode->tokenId = firstNode->data->getId();
|
||||
|
||||
// Use token Id of first node and make first bit 1
|
||||
bundleNode->tokenId = ~(~size_t(0) >> 1) + firstNode->data->getId();
|
||||
bundleNode->bundleInfo.layoutVertical = firstNode->bundleInfo.layoutVertical;
|
||||
bundleNode->bundleInfo.isReferenced = firstNode->bundleInfo.isReferenced;
|
||||
bundleNode->bundleInfo.isReferencing = firstNode->bundleInfo.isReferencing;
|
||||
@@ -801,7 +828,8 @@ void GraphController::bundleNodesMatching(
|
||||
nodes.erase(matchedNodes[i]);
|
||||
}
|
||||
|
||||
bundleNode->tokenId = bundleNode->bundledNodes[0]->data->getId();
|
||||
// Use token Id of first node and make first bit 1
|
||||
bundleNode->tokenId = ~(~size_t(0) >> 1) + bundleNode->bundledNodes[0]->data->getId();
|
||||
m_dummyNodes.push_back(bundleNode);
|
||||
}
|
||||
|
||||
@@ -817,6 +845,8 @@ void GraphController::bundleNodesMatching(
|
||||
|
||||
void GraphController::bundleNodesByType()
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::vector<std::shared_ptr<DummyNode>> oldNodes = m_dummyNodes;
|
||||
m_dummyNodes.clear();
|
||||
|
||||
@@ -864,6 +894,8 @@ void GraphController::bundleNodesByType()
|
||||
|
||||
void GraphController::layoutNesting()
|
||||
{
|
||||
TRACE();
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
{
|
||||
layoutNestingRecursive(node.get());
|
||||
@@ -1096,6 +1128,8 @@ void GraphController::layoutToGrid(DummyNode* node) const
|
||||
|
||||
void GraphController::layoutGraph(bool sort)
|
||||
{
|
||||
TRACE();
|
||||
|
||||
BucketGrid grid(getView()->getViewSize());
|
||||
grid.createBuckets(m_dummyNodes, m_dummyEdges);
|
||||
|
||||
@@ -1118,10 +1152,295 @@ DummyNode* GraphController::getDummyGraphNodeById(Id tokenId) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void GraphController::buildGraph(MessageBase* message)
|
||||
void GraphController::buildGraph(MessageBase* message, bool animated)
|
||||
{
|
||||
if (!message->isReplayed())
|
||||
{
|
||||
getView()->rebuildGraph(m_graph, m_dummyNodes, m_dummyEdges);
|
||||
getView()->rebuildGraph(m_graph, m_dummyNodes, m_dummyEdges, animated);
|
||||
}
|
||||
}
|
||||
|
||||
void GraphController::forEachDummyNodeRecursive(std::function<void(DummyNode*)> func)
|
||||
{
|
||||
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
{
|
||||
node->forEachDummyNodeRecursive(func);
|
||||
}
|
||||
}
|
||||
|
||||
void GraphController::forEachDummyEdge(std::function<void(DummyEdge*)> func)
|
||||
{
|
||||
for (std::shared_ptr<DummyEdge> edge : m_dummyEdges)
|
||||
{
|
||||
func(edge.get());
|
||||
}
|
||||
}
|
||||
|
||||
void GraphController::handleMessage(MessageColorSchemeTest* message)
|
||||
{
|
||||
clear();
|
||||
|
||||
std::shared_ptr<Graph> graph = std::make_shared<Graph>();
|
||||
|
||||
std::function<void(Id, Node::NodeType)> createNodes(
|
||||
[&](Id id, Node::NodeType type)
|
||||
{
|
||||
std::string name = Node::getTypeString(type);
|
||||
graph->createNode(id + 1, type, NameHierarchy(name), true);
|
||||
graph->createNode(id + 2, type, NameHierarchy("focused " + name), true);
|
||||
graph->createNode(id + 3, type, NameHierarchy("active " + name), true);
|
||||
|
||||
graph->createNode(id + 4, type, NameHierarchy("undefined " + name), true);
|
||||
graph->createNode(id + 5, type, NameHierarchy("undefined focused " + name), true);
|
||||
graph->createNode(id + 6, type, NameHierarchy("undefined active " + name), true);
|
||||
}
|
||||
);
|
||||
|
||||
createNodes( 0, Node::NODE_FUNCTION);
|
||||
createNodes(10, Node::NODE_GLOBAL_VARIABLE);
|
||||
createNodes(20, Node::NODE_UNDEFINED);
|
||||
createNodes(30, Node::NODE_TYPE);
|
||||
createNodes(40, Node::NODE_TYPEDEF);
|
||||
createNodes(50, Node::NODE_NAMESPACE);
|
||||
createNodes(60, Node::NODE_FILE);
|
||||
createNodes(70, Node::NODE_MACRO);
|
||||
|
||||
std::function<Node*(Node*, Id, Node::NodeType, std::string, TokenComponentAccess::AccessType)> createChild(
|
||||
[&](Node* parent, Id id, Node::NodeType type, std::string name, TokenComponentAccess::AccessType access)
|
||||
{
|
||||
Node* node = graph->createNode(id + 1000, type, NameHierarchy(name), true);
|
||||
Edge* edge = graph->createEdge(id + 10000, Edge::EDGE_MEMBER, parent, node);
|
||||
|
||||
if (access != TokenComponentAccess::ACCESS_NONE)
|
||||
{
|
||||
edge->addComponentAccess(std::make_shared<TokenComponentAccess>(access));
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
);
|
||||
|
||||
std::function<void(Id, std::string)> createEnum(
|
||||
[&](Id id, std::string name)
|
||||
{
|
||||
Node* enumNode = graph->createNode(id, Node::NODE_ENUM,
|
||||
NameHierarchy(name + Node::getTypeString(Node::NODE_ENUM)), true);
|
||||
createChild(enumNode, id + 10, Node::NODE_ENUM_CONSTANT, name + Node::getTypeString(Node::NODE_ENUM_CONSTANT),
|
||||
TokenComponentAccess::ACCESS_NONE);
|
||||
}
|
||||
);
|
||||
|
||||
createEnum(101, "");
|
||||
createEnum(102, "focused ");
|
||||
createEnum(103, "active ");
|
||||
|
||||
createEnum(104, "undefined ");
|
||||
createEnum(105, "undefined focused ");
|
||||
createEnum(106, "undefined active ");
|
||||
|
||||
std::function<void(Id, Node::NodeType, std::string)> createClass(
|
||||
[&](Id id, Node::NodeType type, std::string name)
|
||||
{
|
||||
Node* classNode = graph->createNode(id, type, NameHierarchy(name + Node::getTypeString(type)), true);
|
||||
|
||||
if (type == Node::NODE_CLASS)
|
||||
{
|
||||
createChild(classNode, id, Node::NODE_TEMPLATE_PARAMETER_TYPE, name + "temp_param",
|
||||
TokenComponentAccess::ACCESS_TEMPLATE);
|
||||
}
|
||||
|
||||
createChild(classNode, id + 10, Node::NODE_METHOD, name + "method", TokenComponentAccess::ACCESS_PUBLIC);
|
||||
if (type == Node::NODE_CLASS)
|
||||
{
|
||||
createChild(classNode, id + 30, Node::NODE_METHOD, name + "method",
|
||||
TokenComponentAccess::ACCESS_PROTECTED);
|
||||
}
|
||||
createChild(classNode, id + 60, Node::NODE_FIELD, name + "field", TokenComponentAccess::ACCESS_PRIVATE);
|
||||
}
|
||||
);
|
||||
|
||||
std::function<void(Id, Node::NodeType)> createClasses(
|
||||
[&](Id id, Node::NodeType type)
|
||||
{
|
||||
createClass(id + 1, type, "");
|
||||
createClass(id + 2, type, "focused ");
|
||||
createClass(id + 3, type, "active ");
|
||||
|
||||
createClass(id + 4, type, "undefined ");
|
||||
createClass(id + 5, type, "undefined focused ");
|
||||
createClass(id + 6, type, "undefined active ");
|
||||
}
|
||||
);
|
||||
|
||||
createClasses(200, Node::NODE_STRUCT);
|
||||
createClasses(300, Node::NODE_CLASS);
|
||||
|
||||
|
||||
std::function<void(Id, Edge::EdgeType, Node::NodeType, Node::NodeType, std::string)> createEdge(
|
||||
[&](Id id, Edge::EdgeType type, Node::NodeType origin, Node::NodeType target, std::string name)
|
||||
{
|
||||
Node* originNode;
|
||||
if (origin == Node::NODE_METHOD)
|
||||
{
|
||||
Node* classNode = graph->createNode(id + 101, Node::NODE_CLASS,
|
||||
NameHierarchy(name + Node::getTypeString(Node::NODE_CLASS)), true);
|
||||
originNode = createChild(classNode, id + 111, Node::NODE_METHOD, name + Edge::getTypeString(type),
|
||||
TokenComponentAccess::ACCESS_PUBLIC);
|
||||
}
|
||||
else
|
||||
{
|
||||
originNode = graph->createNode(id + 1, origin, NameHierarchy(name + Edge::getTypeString(type)), true);
|
||||
}
|
||||
|
||||
Node* targetNode;
|
||||
if (target == Node::NODE_METHOD)
|
||||
{
|
||||
Node* classNode = graph->createNode(id + 201, Node::NODE_CLASS,
|
||||
NameHierarchy(name + Node::getTypeString(Node::NODE_CLASS)), true);
|
||||
targetNode = createChild(classNode, id + 211, Node::NODE_METHOD, name + Edge::getTypeString(type),
|
||||
TokenComponentAccess::ACCESS_PUBLIC);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetNode = graph->createNode(id + 11, target, NameHierarchy(name + Edge::getTypeString(type)), true);
|
||||
}
|
||||
|
||||
Edge* edge = graph->createEdge(id, type, originNode, targetNode);
|
||||
|
||||
if (type == Edge::EDGE_AGGREGATION)
|
||||
{
|
||||
std::shared_ptr<TokenComponentAggregation> agg = std::make_shared<TokenComponentAggregation>();
|
||||
for (Id i = 1; i < 11; i++)
|
||||
{
|
||||
agg->addAggregationId(i, true);
|
||||
}
|
||||
edge->addComponentAggregation(agg);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
std::function<void(Id, Edge::EdgeType, Node::NodeType, Node::NodeType)> createEdges(
|
||||
[&](Id id, Edge::EdgeType type, Node::NodeType origin, Node::NodeType target)
|
||||
{
|
||||
createEdge(id, type, origin, target, "");
|
||||
createEdge(id + 1000, type, origin, target, "focused ");
|
||||
createEdge(id + 2000, type, origin, target, "active ");
|
||||
}
|
||||
);
|
||||
|
||||
createEdges( 100000, Edge::EDGE_CALL, Node::NODE_FUNCTION, Node::NODE_FUNCTION);
|
||||
createEdges( 200000, Edge::EDGE_USAGE, Node::NODE_GLOBAL_VARIABLE, Node::NODE_GLOBAL_VARIABLE);
|
||||
createEdges( 300000, Edge::EDGE_TYPE_USAGE, Node::NODE_FUNCTION, Node::NODE_TYPE);
|
||||
createEdges( 400000, Edge::EDGE_TYPE_OF, Node::NODE_GLOBAL_VARIABLE, Node::NODE_TYPE);
|
||||
|
||||
createEdges( 500000, Edge::EDGE_TYPEDEF_OF, Node::NODE_TYPEDEF, Node::NODE_TYPE);
|
||||
createEdges( 600000, Edge::EDGE_AGGREGATION, Node::NODE_TYPE, Node::NODE_TYPE);
|
||||
createEdges( 700000, Edge::EDGE_INCLUDE, Node::NODE_FILE, Node::NODE_FILE);
|
||||
createEdges( 800000, Edge::EDGE_MACRO_USAGE, Node::NODE_MACRO, Node::NODE_MACRO);
|
||||
|
||||
createEdges( 900000, Edge::EDGE_INHERITANCE, Node::NODE_CLASS, Node::NODE_CLASS);
|
||||
createEdges(1000000, Edge::EDGE_OVERRIDE, Node::NODE_METHOD, Node::NODE_METHOD);
|
||||
|
||||
createEdges(1100000, Edge::EDGE_TEMPLATE_ARGUMENT, Node::NODE_TYPE, Node::NODE_TYPE);
|
||||
createEdges(1200000, Edge::EDGE_TEMPLATE_DEFAULT_ARGUMENT, Node::NODE_TYPE, Node::NODE_TYPE);
|
||||
createEdges(1300000, Edge::EDGE_TEMPLATE_SPECIALIZATION_OF, Node::NODE_TYPE, Node::NODE_TYPE);
|
||||
createEdges(1400000, Edge::EDGE_TEMPLATE_MEMBER_SPECIALIZATION_OF, Node::NODE_METHOD, Node::NODE_METHOD);
|
||||
|
||||
std::vector<Id> focusedTokenIds;
|
||||
std::vector<Id> activeTokenIds;
|
||||
|
||||
graph->forEachNode(
|
||||
[&](Node* node)
|
||||
{
|
||||
Id id = node->getId();
|
||||
if (id % 10 < 4)
|
||||
{
|
||||
node->setExplicit(true);
|
||||
}
|
||||
|
||||
if (id % 10 == 2 || id % 10 == 5)
|
||||
{
|
||||
focusedTokenIds.push_back(id);
|
||||
}
|
||||
else if (id % 10 == 3 || id % 10 == 6)
|
||||
{
|
||||
activeTokenIds.push_back(id);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
graph->forEachEdge(
|
||||
[&](Edge* edge)
|
||||
{
|
||||
Id id = edge->getId();
|
||||
if (id % 10000 == 1000)
|
||||
{
|
||||
focusedTokenIds.push_back(id);
|
||||
}
|
||||
else if (id % 10000 == 2000)
|
||||
{
|
||||
activeTokenIds.push_back(id);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
createDummyGraphForTokenIds(std::vector<Id>(), graph);
|
||||
|
||||
for (size_t i = 0; i < 2; i++)
|
||||
{
|
||||
std::shared_ptr<DummyNode> bundleNode = std::make_shared<DummyNode>();
|
||||
bundleNode->tokenId = 10000001 + i;
|
||||
bundleNode->name = "bundle";
|
||||
|
||||
if (i == 1)
|
||||
{
|
||||
bundleNode->name = "focused bundle";
|
||||
focusedTokenIds.push_back(bundleNode->tokenId);
|
||||
}
|
||||
|
||||
bundleNode->bundledNodes.push_back(std::make_shared<DummyNode>());
|
||||
bundleNode->bundledNodeCount = 123;
|
||||
m_dummyNodes.push_back(bundleNode);
|
||||
}
|
||||
|
||||
forEachDummyNodeRecursive(
|
||||
[](DummyNode* node)
|
||||
{
|
||||
node->visible = true;
|
||||
|
||||
if (node->subNodes.size())
|
||||
{
|
||||
node->expanded = true;
|
||||
node->childVisible = true;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
forEachDummyEdge(
|
||||
[](DummyEdge* edge)
|
||||
{
|
||||
edge->visible = true;
|
||||
edge->active = true;
|
||||
}
|
||||
);
|
||||
|
||||
setActive(activeTokenIds);
|
||||
|
||||
layoutNesting();
|
||||
|
||||
for (size_t i = 0; i < m_dummyNodes.size(); i++)
|
||||
{
|
||||
DummyNode* node = m_dummyNodes[i].get();
|
||||
|
||||
node->layoutBucket.x = i % 6 + 1;
|
||||
node->layoutBucket.y = (i / 6) + 1;
|
||||
}
|
||||
|
||||
BucketGrid grid(Vec2i(0, 0));
|
||||
grid.createBuckets(m_dummyNodes, std::vector<std::shared_ptr<DummyEdge>>());
|
||||
grid.layoutBuckets();
|
||||
|
||||
buildGraph(message, false);
|
||||
|
||||
getView()->focusTokenIds(focusedTokenIds);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
#include "utility/messaging/type/MessageActivateAll.h"
|
||||
#include "utility/messaging/type/MessageActivateTokens.h"
|
||||
#include "utility/messaging/type/MessageColorSchemeTest.h"
|
||||
#include "utility/messaging/type/MessageFlushUpdates.h"
|
||||
#include "utility/messaging/type/MessageFocusIn.h"
|
||||
#include "utility/messaging/type/MessageFocusOut.h"
|
||||
@@ -31,6 +32,7 @@ class GraphController
|
||||
: public Controller
|
||||
, public MessageListener<MessageActivateAll>
|
||||
, public MessageListener<MessageActivateTokens>
|
||||
, public MessageListener<MessageColorSchemeTest>
|
||||
, public MessageListener<MessageFlushUpdates>
|
||||
, public MessageListener<MessageFocusIn>
|
||||
, public MessageListener<MessageFocusOut>
|
||||
@@ -61,6 +63,8 @@ private:
|
||||
virtual void clear();
|
||||
|
||||
void createDummyGraphForTokenIds(const std::vector<Id>& tokenIds, const std::shared_ptr<Graph> graph);
|
||||
void createDummyGraphForTokenIdsAndSetActiveAndVisibility(
|
||||
const std::vector<Id>& tokenIds, const std::shared_ptr<Graph> graph);
|
||||
std::shared_ptr<DummyNode> createDummyNodeTopDown(Node* node, Id parentId);
|
||||
|
||||
std::vector<Id> getExpandedNodeIds() const;
|
||||
@@ -89,7 +93,12 @@ private:
|
||||
|
||||
DummyNode* getDummyGraphNodeById(Id tokenId) const;
|
||||
|
||||
void buildGraph(MessageBase* message);
|
||||
void buildGraph(MessageBase* message, bool animated = true);
|
||||
|
||||
void forEachDummyNodeRecursive(std::function<void(DummyNode*)> func);
|
||||
void forEachDummyEdge(std::function<void(DummyEdge*)> func);
|
||||
|
||||
virtual void handleMessage(MessageColorSchemeTest* message);
|
||||
|
||||
StorageAccess* m_storageAccess;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "component/view/SearchView.h"
|
||||
#include "data/access/StorageAccess.h"
|
||||
#include "utility/tracing.h"
|
||||
|
||||
SearchController::SearchController(StorageAccess* storageAccess)
|
||||
: m_storageAccess(storageAccess)
|
||||
@@ -12,12 +13,6 @@ SearchController::~SearchController()
|
||||
{
|
||||
}
|
||||
|
||||
void SearchController::handleMessage(MessageActivateAll* message)
|
||||
{
|
||||
SearchMatch match = SearchMatch::createCommand(SearchMatch::COMMAND_ALL);
|
||||
getView()->setMatches(std::vector<SearchMatch>(1, match));
|
||||
}
|
||||
|
||||
void SearchController::handleMessage(MessageActivateTokens* message)
|
||||
{
|
||||
if (!message->isFromSearch)
|
||||
@@ -57,8 +52,25 @@ void SearchController::handleMessage(MessageFind* message)
|
||||
}
|
||||
}
|
||||
|
||||
void SearchController::handleMessage(MessageSearch* message)
|
||||
{
|
||||
const std::vector<SearchMatch>& matches = message->getMatches();
|
||||
|
||||
for (const SearchMatch& match : matches)
|
||||
{
|
||||
if (match.searchType == SearchMatch::SEARCH_COMMAND)
|
||||
{
|
||||
SearchMatch m = SearchMatch::createCommand(SearchMatch::getCommandType(match.getFullName()));
|
||||
getView()->setMatches(std::vector<SearchMatch>(1, m));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SearchController::handleMessage(MessageSearchAutocomplete* message)
|
||||
{
|
||||
TRACE("search autocomplete");
|
||||
|
||||
LOG_INFO("autocomplete string: \"" + message->query + "\"");
|
||||
getView()->setAutocompletionList(m_storageAccess->getAutocompletionMatches(message->query));
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
#include "component/controller/Controller.h"
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
#include "utility/messaging/type/MessageActivateAll.h"
|
||||
#include "utility/messaging/type/MessageActivateTokens.h"
|
||||
#include "utility/messaging/type/MessageFind.h"
|
||||
#include "utility/messaging/type/MessageSearch.h"
|
||||
#include "utility/messaging/type/MessageSearchAutocomplete.h"
|
||||
#include "utility/messaging/type/MessageSearchFullText.h"
|
||||
#include "utility/messaging/type/MessageShowErrors.h"
|
||||
@@ -15,9 +15,9 @@ class SearchView;
|
||||
|
||||
class SearchController
|
||||
: public Controller
|
||||
, public MessageListener<MessageActivateAll>
|
||||
, public MessageListener<MessageActivateTokens>
|
||||
, public MessageListener<MessageFind>
|
||||
, public MessageListener<MessageSearch>
|
||||
, public MessageListener<MessageSearchAutocomplete>
|
||||
, public MessageListener<MessageSearchFullText>
|
||||
, public MessageListener<MessageShowErrors>
|
||||
@@ -27,9 +27,9 @@ public:
|
||||
~SearchController();
|
||||
|
||||
private:
|
||||
virtual void handleMessage(MessageActivateAll* message);
|
||||
virtual void handleMessage(MessageActivateTokens* message);
|
||||
virtual void handleMessage(MessageFind* message);
|
||||
virtual void handleMessage(MessageSearch* message);
|
||||
virtual void handleMessage(MessageSearchAutocomplete* message);
|
||||
virtual void handleMessage(MessageSearchFullText* message);
|
||||
virtual void handleMessage(MessageShowErrors* message);
|
||||
|
||||
@@ -243,23 +243,40 @@ void UndoRedoController::handleMessage(MessageShowScope* message)
|
||||
|
||||
void UndoRedoController::handleMessage(MessageUndo* message)
|
||||
{
|
||||
if (!m_list.size() || std::prev(m_iterator) == m_list.begin())
|
||||
if (!m_list.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
while (std::prev(m_iterator)->order == Command::ORDER_VIEW)
|
||||
// return to last non view command
|
||||
std::list<Command>::iterator it = m_iterator;
|
||||
while (std::prev(it)->order == Command::ORDER_VIEW)
|
||||
{
|
||||
std::advance(m_iterator, -1);
|
||||
std::advance(it, -1);
|
||||
}
|
||||
std::advance(m_iterator, -1);
|
||||
std::advance(it, -1);
|
||||
|
||||
if (std::distance(m_list.begin(), m_iterator) <= 1)
|
||||
// disable undo button if there is no non view command till the first command
|
||||
std::list<Command>::iterator it2 = std::prev(it);
|
||||
while (it2->order == Command::ORDER_VIEW)
|
||||
{
|
||||
std::advance(it2, -1);
|
||||
}
|
||||
if (it2 == m_list.begin())
|
||||
{
|
||||
getView()->setUndoButtonEnabled(false);
|
||||
}
|
||||
|
||||
// abort if first command is reached
|
||||
if (it == m_list.begin())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
getView()->setRedoButtonEnabled(true);
|
||||
|
||||
m_iterator = it;
|
||||
|
||||
replayCommands();
|
||||
|
||||
MessageFlushUpdates().dispatch();
|
||||
@@ -392,3 +409,39 @@ MessageBase* UndoRedoController::lastMessage() const
|
||||
{
|
||||
return std::prev(m_iterator)->message.get();
|
||||
}
|
||||
|
||||
void UndoRedoController::dump() const
|
||||
{
|
||||
std::cout << "Undo Redo Stack:\n\n";
|
||||
|
||||
std::list<Command>::const_iterator it = m_list.begin();
|
||||
while (it != m_list.end())
|
||||
{
|
||||
switch (it->order)
|
||||
{
|
||||
case Command::ORDER_VIEW:
|
||||
std::cout << "\t";
|
||||
case Command::ORDER_ADAPT:
|
||||
std::cout << "\t";
|
||||
case Command::ORDER_ACTIVATE:
|
||||
break;
|
||||
}
|
||||
|
||||
std::cout << it->message->getType() << " " << it->replayLastOnly;
|
||||
|
||||
if (it == m_iterator)
|
||||
{
|
||||
std::cout << " <-";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
std::advance(it, 1);
|
||||
}
|
||||
|
||||
if (m_list.end() == m_iterator)
|
||||
{
|
||||
std::cout << " <-";
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
@@ -99,6 +99,8 @@ private:
|
||||
bool sameMessageTypeAsLast(MessageBase* message) const;
|
||||
MessageBase* lastMessage() const;
|
||||
|
||||
void dump() const;
|
||||
|
||||
std::list<Command> m_list;
|
||||
std::list<Command>::iterator m_iterator;
|
||||
};
|
||||
|
||||
@@ -76,7 +76,7 @@ void Bucket::sort()
|
||||
|
||||
void Bucket::preLayout(Vec2i viewSize)
|
||||
{
|
||||
int cols = m_height / viewSize.y + 1;
|
||||
int cols = (viewSize.y > 0 ? (m_height / viewSize.y) : 0) + 1;
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
@@ -299,7 +299,7 @@ DummyNode* BucketGrid::findTopMostDummyNodeRecursive(
|
||||
|
||||
void BucketGrid::addNode(DummyNode* node)
|
||||
{
|
||||
Bucket* bucket = getBucket(0, 0);
|
||||
Bucket* bucket = getBucket(node->layoutBucket.x, node->layoutBucket.y);
|
||||
bucket->addNode(node);
|
||||
}
|
||||
|
||||
@@ -310,7 +310,8 @@ bool BucketGrid::addNode(DummyNode* owner, DummyNode* target, bool horizontal)
|
||||
|
||||
if (!ownerBucket && !targetBucket)
|
||||
{
|
||||
return false;
|
||||
ownerBucket = getBucket(0, 0);
|
||||
ownerBucket->addNode(owner);
|
||||
}
|
||||
else if (ownerBucket && targetBucket)
|
||||
{
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
, hasParent(true)
|
||||
, accessType(TokenComponentAccess::ACCESS_NONE)
|
||||
, invisibleSubNodeCount(0)
|
||||
, layoutBucket(0, 0)
|
||||
, bundledNodeCount(0)
|
||||
{
|
||||
}
|
||||
@@ -191,6 +192,16 @@ public:
|
||||
return bundledNodes.size();
|
||||
}
|
||||
|
||||
void forEachDummyNodeRecursive(std::function<void(DummyNode*)> func)
|
||||
{
|
||||
func(this);
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : subNodes)
|
||||
{
|
||||
node->forEachDummyNodeRecursive(func);
|
||||
}
|
||||
}
|
||||
|
||||
Vec2i position;
|
||||
Vec2i size;
|
||||
|
||||
@@ -220,6 +231,9 @@ public:
|
||||
// Bundling
|
||||
BundleInfo bundleInfo;
|
||||
|
||||
// Layout
|
||||
Vec2i layoutBucket;
|
||||
|
||||
// BundleNode
|
||||
std::vector<std::shared_ptr<DummyNode>> bundledNodes;
|
||||
size_t bundledNodeCount;
|
||||
|
||||
@@ -20,7 +20,8 @@ public:
|
||||
virtual void rebuildGraph(
|
||||
std::shared_ptr<Graph> graph,
|
||||
const std::vector<std::shared_ptr<DummyNode>>& nodes,
|
||||
const std::vector<std::shared_ptr<DummyEdge>>& edges) = 0;
|
||||
const std::vector<std::shared_ptr<DummyEdge>>& edges,
|
||||
bool animated) = 0;
|
||||
virtual void clear() = 0;
|
||||
|
||||
virtual void focusTokenIds(const std::vector<Id>& focusedTokenIds) = 0;
|
||||
|
||||
@@ -25,14 +25,29 @@ void View::addToLayout()
|
||||
m_viewLayout->addView(this);
|
||||
}
|
||||
|
||||
void View::setComponent(Component* component)
|
||||
{
|
||||
m_component = component;
|
||||
}
|
||||
|
||||
ViewWidgetWrapper* View::getWidgetWrapper() const
|
||||
{
|
||||
return m_widgetWrapper.get();
|
||||
}
|
||||
|
||||
void View::setComponent(Component* component)
|
||||
void View::createOverlay()
|
||||
{
|
||||
m_component = component;
|
||||
getWidgetWrapper()->createOverlay();
|
||||
}
|
||||
|
||||
void View::showOverlay()
|
||||
{
|
||||
getWidgetWrapper()->showOverlay();
|
||||
}
|
||||
|
||||
void View::hideOverlay()
|
||||
{
|
||||
getWidgetWrapper()->hideOverlay();
|
||||
}
|
||||
|
||||
ViewLayout* View::getViewLayout() const
|
||||
|
||||
@@ -35,6 +35,10 @@ public:
|
||||
|
||||
ViewWidgetWrapper* getWidgetWrapper() const;
|
||||
|
||||
void createOverlay();
|
||||
void showOverlay();
|
||||
void hideOverlay();
|
||||
|
||||
protected:
|
||||
template <typename ControllerType>
|
||||
ControllerType* getController();
|
||||
|
||||
@@ -6,6 +6,10 @@ class ViewWidgetWrapper
|
||||
public:
|
||||
ViewWidgetWrapper();
|
||||
virtual ~ViewWidgetWrapper();
|
||||
|
||||
virtual void createOverlay() = 0;
|
||||
virtual void showOverlay() = 0;
|
||||
virtual void hideOverlay() = 0;
|
||||
};
|
||||
|
||||
#endif // VIEW_WIDGET_WRAPPER_H
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <sstream>
|
||||
#include <queue>
|
||||
|
||||
#include "utility/Cache.h"
|
||||
#include "utility/file/FileSystem.h"
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/messaging/type/MessageClearErrorCount.h"
|
||||
@@ -10,10 +11,10 @@
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/text/TextAccess.h"
|
||||
#include "utility/TimePoint.h"
|
||||
#include "utility/tracing.h"
|
||||
#include "utility/utility.h"
|
||||
#include "utility/utilityString.h"
|
||||
#include "utility/Version.h"
|
||||
#include "utility/Cache.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
#include "data/graph/token_component/TokenComponentAggregation.h"
|
||||
@@ -31,6 +32,7 @@ PersistentStorage::PersistentStorage(const FilePath& dbPath)
|
||||
{
|
||||
m_commandIndex.addNode(0, NameHierarchy(SearchMatch::getCommandName(SearchMatch::COMMAND_ALL)));
|
||||
m_commandIndex.addNode(0, NameHierarchy(SearchMatch::getCommandName(SearchMatch::COMMAND_ERROR)));
|
||||
// m_commandIndex.addNode(0, NameHierarchy(SearchMatch::getCommandName(SearchMatch::COMMAND_COLOR_SCHEME_TEST)));
|
||||
m_commandIndex.finishSetup();
|
||||
}
|
||||
|
||||
@@ -227,7 +229,7 @@ void PersistentStorage::finishInjection()
|
||||
{
|
||||
MessageShowErrors msg(errorCount);
|
||||
msg.setSendAsTask(false);
|
||||
msg.dispatch();
|
||||
msg.dispatchImmediately();
|
||||
}
|
||||
m_preInjectionErrorCount = -1;
|
||||
}
|
||||
@@ -265,6 +267,8 @@ void PersistentStorage::clearCaches()
|
||||
|
||||
std::set<FilePath> PersistentStorage::getDependingFilePaths(const std::set<FilePath>& filePaths)
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::set<FilePath> dependingFilePaths;
|
||||
for (const FilePath& filePath: filePaths)
|
||||
{
|
||||
@@ -295,6 +299,8 @@ std::set<FilePath> PersistentStorage::getDependingFilePaths(const FilePath& file
|
||||
|
||||
void PersistentStorage::clearFileElements(const std::vector<FilePath>& filePaths)
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::vector<Id> fileNodeIds;
|
||||
|
||||
for (const FilePath& path : filePaths)
|
||||
@@ -313,6 +319,8 @@ void PersistentStorage::clearFileElements(const std::vector<FilePath>& filePaths
|
||||
|
||||
std::vector<FileInfo> PersistentStorage::getInfoOnAllFiles() const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::vector<FileInfo> fileInfos;
|
||||
|
||||
std::vector<StorageFile> storageFiles = m_sqliteStorage.getAllFiles();
|
||||
@@ -334,6 +342,8 @@ std::vector<FileInfo> PersistentStorage::getInfoOnAllFiles() const
|
||||
|
||||
void PersistentStorage::logStats() const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::stringstream ss;
|
||||
StorageStats stats = getStorageStats();
|
||||
|
||||
@@ -349,7 +359,7 @@ void PersistentStorage::logStats() const
|
||||
ss << "\t" << stats.errorCount.total << " Errors\n";
|
||||
ss << "\t" << stats.errorCount.fatal << " Fatal Errors\n";
|
||||
|
||||
LOG_WARNING(ss.str());
|
||||
LOG_INFO(ss.str());
|
||||
}
|
||||
|
||||
void PersistentStorage::startParsing()
|
||||
@@ -361,6 +371,8 @@ void PersistentStorage::startParsing()
|
||||
|
||||
void PersistentStorage::finishParsing()
|
||||
{
|
||||
TRACE();
|
||||
|
||||
buildSearchIndex();
|
||||
buildFilePathMaps();
|
||||
buildHierarchyCache();
|
||||
@@ -368,6 +380,8 @@ void PersistentStorage::finishParsing()
|
||||
|
||||
void PersistentStorage::optimizeMemory()
|
||||
{
|
||||
TRACE();
|
||||
|
||||
m_sqliteStorage.optimizeMemory();
|
||||
}
|
||||
|
||||
@@ -399,6 +413,8 @@ std::shared_ptr<TokenLocationCollection> PersistentStorage::getFullTextSearchLoc
|
||||
const std::string& searchTerm, bool caseSensitive
|
||||
) const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
if (m_fullTextSearchIndex.fileCount() == 0)
|
||||
{
|
||||
MessageStatus("Building fulltext search index", false, true).dispatch();
|
||||
@@ -485,6 +501,8 @@ std::shared_ptr<TokenLocationCollection> PersistentStorage::getFullTextSearchLoc
|
||||
|
||||
std::vector<SearchMatch> PersistentStorage::getAutocompletionMatches(const std::string& query) const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::vector<SearchResult> commandResults = m_commandIndex.search(query, 0);
|
||||
|
||||
const size_t maxResultCount = 100;
|
||||
@@ -638,6 +656,8 @@ std::vector<SearchMatch> PersistentStorage::getSearchMatchesForTokenIds(const st
|
||||
|
||||
std::shared_ptr<Graph> PersistentStorage::getGraphForAll() const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::shared_ptr<Graph> graph = std::make_shared<Graph>();
|
||||
|
||||
std::vector<Id> tokenIds;
|
||||
@@ -658,6 +678,8 @@ std::shared_ptr<Graph> PersistentStorage::getGraphForAll() const
|
||||
|
||||
std::shared_ptr<Graph> PersistentStorage::getGraphForActiveTokenIds(const std::vector<Id>& tokenIds) const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::shared_ptr<Graph> g = std::make_shared<Graph>();
|
||||
Graph* graph = g.get();
|
||||
|
||||
@@ -775,6 +797,8 @@ std::vector<Id> PersistentStorage::getActiveTokenIdsForId(Id tokenId, Id* declar
|
||||
|
||||
std::vector<Id> PersistentStorage::getNodeIdsForLocationIds(const std::vector<Id>& locationIds) const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::set<Id> edgeIds;
|
||||
std::set<Id> nodeIds;
|
||||
std::set<Id> implicitNodeIds;
|
||||
@@ -868,6 +892,8 @@ Id PersistentStorage::getTokenIdForFileNode(const FilePath& filePath) const
|
||||
std::shared_ptr<TokenLocationCollection> PersistentStorage::getTokenLocationsForTokenIds(
|
||||
const std::vector<Id>& tokenIds) const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::shared_ptr<TokenLocationCollection> collection = std::make_shared<TokenLocationCollection>();
|
||||
|
||||
std::vector<Id> fileIds;
|
||||
@@ -919,6 +945,8 @@ std::shared_ptr<TokenLocationCollection> PersistentStorage::getTokenLocationsFor
|
||||
const std::vector<Id>& locationIds
|
||||
) const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::shared_ptr<TokenLocationCollection> collection = std::make_shared<TokenLocationCollection>();
|
||||
|
||||
for (size_t i = 0; i < locationIds.size(); i++)
|
||||
@@ -940,6 +968,8 @@ std::shared_ptr<TokenLocationCollection> PersistentStorage::getTokenLocationsFor
|
||||
|
||||
std::shared_ptr<TokenLocationFile> PersistentStorage::getTokenLocationsForFile(const std::string& filePath) const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
return m_sqliteStorage.getTokenLocationsForFile(filePath);
|
||||
}
|
||||
|
||||
@@ -947,11 +977,15 @@ std::shared_ptr<TokenLocationFile> PersistentStorage::getTokenLocationsForLinesI
|
||||
const std::string& filePath, uint firstLineNumber, uint lastLineNumber
|
||||
) const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
return getTokenLocationsForFile(filePath)->getFilteredByLines(firstLineNumber, lastLineNumber);
|
||||
}
|
||||
|
||||
std::shared_ptr<TokenLocationCollection> PersistentStorage::getErrorTokenLocations(std::vector<ErrorInfo>* errors) const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::shared_ptr<TokenLocationCollection> errorCollection = std::make_shared<TokenLocationCollection>();
|
||||
|
||||
std::vector<StorageError> storageErrors = m_sqliteStorage.getAllErrors();
|
||||
@@ -969,6 +1003,8 @@ std::shared_ptr<TokenLocationCollection> PersistentStorage::getErrorTokenLocatio
|
||||
|
||||
std::shared_ptr<TokenLocationFile> PersistentStorage::getCommentLocationsInFile(const FilePath& filePath) const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::shared_ptr<TokenLocationFile> file = std::make_shared<TokenLocationFile>(filePath);
|
||||
|
||||
std::vector<StorageCommentLocation> storageLocations = m_sqliteStorage.getCommentLocationsInFile(filePath);
|
||||
@@ -1017,6 +1053,8 @@ ErrorCountInfo PersistentStorage::getErrorCount() const
|
||||
|
||||
StorageStats PersistentStorage::getStorageStats() const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
StorageStats stats;
|
||||
|
||||
stats.nodeCount = m_sqliteStorage.getNodeCount();
|
||||
@@ -1083,6 +1121,8 @@ std::vector<Id> PersistentStorage::getAllChildNodeIds(const Id nodeId) const
|
||||
|
||||
void PersistentStorage::addNodesToGraph(const std::vector<Id>& nodeIds, Graph* graph) const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
if (nodeIds.size() == 0)
|
||||
{
|
||||
return;
|
||||
@@ -1127,6 +1167,8 @@ void PersistentStorage::addNodesToGraph(const std::vector<Id>& nodeIds, Graph* g
|
||||
|
||||
void PersistentStorage::addEdgesToGraph(const std::vector<Id>& edgeIds, Graph* graph) const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
if (edgeIds.size() == 0)
|
||||
{
|
||||
return;
|
||||
@@ -1153,6 +1195,8 @@ void PersistentStorage::addNodesWithChildrenAndEdgesToGraph(
|
||||
const std::vector<Id>& nodeIds, const std::vector<Id>& edgeIds, Graph* graph
|
||||
) const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::set<Id> parentNodeIds;
|
||||
|
||||
for (Id nodeId : nodeIds)
|
||||
@@ -1185,6 +1229,8 @@ void PersistentStorage::addNodesWithChildrenAndEdgesToGraph(
|
||||
|
||||
void PersistentStorage::addAggregationEdgesToGraph(const Id nodeId, Graph* graph) const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
struct EdgeInfo
|
||||
{
|
||||
Id edgeId;
|
||||
@@ -1277,6 +1323,8 @@ void PersistentStorage::addAggregationEdgesToGraph(const Id nodeId, Graph* graph
|
||||
|
||||
void PersistentStorage::addComponentAccessToGraph(Graph* graph) const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::vector<Id> memberEdgeIds;
|
||||
|
||||
graph->forEachEdge(
|
||||
@@ -1304,15 +1352,22 @@ void PersistentStorage::addComponentAccessToGraph(Graph* graph) const
|
||||
|
||||
void PersistentStorage::buildSearchIndex()
|
||||
{
|
||||
for (StorageNode node: m_sqliteStorage.getAllNodes())
|
||||
TRACE();
|
||||
|
||||
for (StorageNode node : m_sqliteStorage.getAllNodes())
|
||||
{
|
||||
m_elementIndex.addNode(node.id, NameHierarchy::deserialize(node.serializedName));
|
||||
if (intToDefinitionType(node.definitionType) != DEFINITION_IMPLICIT)
|
||||
{
|
||||
m_elementIndex.addNode(node.id, NameHierarchy::deserialize(node.serializedName));
|
||||
}
|
||||
}
|
||||
m_elementIndex.finishSetup();
|
||||
}
|
||||
|
||||
void PersistentStorage::buildFilePathMaps()
|
||||
{
|
||||
TRACE();
|
||||
|
||||
for (StorageFile file: m_sqliteStorage.getAllFiles())
|
||||
{
|
||||
m_fileNodeIds.emplace(file.filePath, file.id);
|
||||
@@ -1322,6 +1377,8 @@ void PersistentStorage::buildFilePathMaps()
|
||||
|
||||
void PersistentStorage::buildFullTextSearchIndex() const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
for (StorageFile file : m_sqliteStorage.getAllFiles())
|
||||
{
|
||||
m_fullTextSearchIndex.addFile(file.id, m_sqliteStorage.getFileContentById(file.id)->getText());
|
||||
@@ -1330,6 +1387,8 @@ void PersistentStorage::buildFullTextSearchIndex() const
|
||||
|
||||
void PersistentStorage::buildHierarchyCache()
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::vector<StorageEdge> memberEdges = m_sqliteStorage.getEdgesByType(Edge::typeToInt(Edge::EDGE_MEMBER));
|
||||
|
||||
Cache<Id, Node::NodeType> nodeTypeCache([this](Id id){
|
||||
|
||||
@@ -223,6 +223,8 @@ Id SqliteStorage::addError(const std::string& message, bool fatal, const std::st
|
||||
return q.getIntField(0, -1);
|
||||
}
|
||||
|
||||
stmt.finalize();
|
||||
|
||||
stmt = m_database.compileStatement((
|
||||
"INSERT INTO error(message, fatal, file_path, line_number, column_number) "
|
||||
"VALUES (?, " + std::to_string(fatal) + ", '" + filePath +
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "data/graph/Edge.h"
|
||||
#include "data/StorageTypes.h"
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/tracing.h"
|
||||
|
||||
Storage::Storage()
|
||||
{
|
||||
@@ -26,6 +27,8 @@ void Storage::finishInjection()
|
||||
|
||||
void Storage::inject(Storage* injected)
|
||||
{
|
||||
TRACE();
|
||||
|
||||
startInjection();
|
||||
|
||||
std::unordered_map<Id, Id> injectedIdToOwnId;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include "data/fulltextsearch/FullTextSearchIndex.h"
|
||||
#include <limits>
|
||||
|
||||
#include "utility/utility.h"
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/tracing.h"
|
||||
#include "utility/utility.h"
|
||||
|
||||
void FullTextSearchIndex::addFile(Id fileId, const std::string& file)
|
||||
{
|
||||
@@ -22,6 +23,8 @@ void FullTextSearchIndex::addFile(Id fileId, const std::string& file)
|
||||
|
||||
std::vector<FullTextSearchResult> FullTextSearchIndex::searchForTerm(const std::string& term) const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::vector<FullTextSearchResult> ret;
|
||||
FullTextSearchResult hit;
|
||||
for (auto f : m_files)
|
||||
|
||||
@@ -21,7 +21,7 @@ std::string NameHierarchy::serialize(NameHierarchy nameHierarchy)
|
||||
NameHierarchy NameHierarchy::deserialize(const std::string& serializedName)
|
||||
{
|
||||
NameHierarchy nameHierarchy;
|
||||
|
||||
|
||||
std::vector<std::string> serializedNameElements = utility::splitToVector(serializedName, "\n");
|
||||
for (size_t i = 0; i < serializedNameElements.size(); i++)
|
||||
{
|
||||
@@ -46,6 +46,14 @@ NameHierarchy::NameHierarchy(const std::string& name)
|
||||
push(std::make_shared<NameElement>(name));
|
||||
}
|
||||
|
||||
NameHierarchy::NameHierarchy(const std::vector<std::string>& names)
|
||||
{
|
||||
for (const std::string& name : names)
|
||||
{
|
||||
push(std::make_shared<NameElement>(name));
|
||||
}
|
||||
}
|
||||
|
||||
NameHierarchy::~NameHierarchy()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ public:
|
||||
|
||||
NameHierarchy();
|
||||
NameHierarchy(const std::string& name);
|
||||
NameHierarchy(const std::vector<std::string>& names);
|
||||
~NameHierarchy();
|
||||
|
||||
void push(std::shared_ptr<NameElement> element);
|
||||
|
||||
@@ -32,7 +32,6 @@ std::string SearchMatch::getSearchTypeName(SearchType type)
|
||||
case SEARCH_FULLTEXT:
|
||||
return "fulltext";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::string SearchMatch::searchMatchesToString(const std::vector<SearchMatch>& matches)
|
||||
@@ -64,11 +63,31 @@ std::string SearchMatch::getCommandName(CommandType type)
|
||||
return "overview";
|
||||
case COMMAND_ERROR:
|
||||
return "error";
|
||||
case COMMAND_COLOR_SCHEME_TEST:
|
||||
return "color_scheme_test";
|
||||
}
|
||||
|
||||
return "none";
|
||||
}
|
||||
|
||||
SearchMatch::CommandType SearchMatch::getCommandType(const std::string& name)
|
||||
{
|
||||
if (name == "overview")
|
||||
{
|
||||
return COMMAND_ALL;
|
||||
}
|
||||
else if (name == "error")
|
||||
{
|
||||
return COMMAND_ERROR;
|
||||
}
|
||||
else if (name == "color_scheme_test")
|
||||
{
|
||||
return COMMAND_COLOR_SCHEME_TEST;
|
||||
}
|
||||
|
||||
return COMMAND_ALL;
|
||||
}
|
||||
|
||||
SearchMatch::SearchMatch()
|
||||
: typeName("")
|
||||
, searchType(SEARCH_NONE)
|
||||
|
||||
@@ -23,7 +23,8 @@ struct SearchMatch
|
||||
enum CommandType
|
||||
{
|
||||
COMMAND_ALL,
|
||||
COMMAND_ERROR
|
||||
COMMAND_ERROR,
|
||||
COMMAND_COLOR_SCHEME_TEST
|
||||
};
|
||||
|
||||
static void log(const std::vector<SearchMatch>& matches, const std::string& query);
|
||||
@@ -33,6 +34,7 @@ struct SearchMatch
|
||||
|
||||
static SearchMatch createCommand(CommandType type);
|
||||
static std::string getCommandName(CommandType type);
|
||||
static CommandType getCommandType(const std::string& name);
|
||||
|
||||
static const char FULLTEXT_SEARCH_CHARACTER = '?';
|
||||
|
||||
|
||||
@@ -157,11 +157,6 @@ bool ProjectSettings::setSourceExtensions(const std::vector<std::string> &source
|
||||
return setValues("source/extensions/source_extensions", sourceExtensions);
|
||||
}
|
||||
|
||||
bool ProjectSettings::isUseSourcePathsForHeaderSearchDefined() const
|
||||
{
|
||||
return isValueDefined("source/use_source_paths_for_header_search");
|
||||
}
|
||||
|
||||
bool ProjectSettings::getUseSourcePathsForHeaderSearch() const
|
||||
{
|
||||
return getValue<bool>("source/use_source_paths_for_header_search", false);
|
||||
|
||||
@@ -47,7 +47,6 @@ public:
|
||||
std::vector<std::string> getSourceExtensions() const;
|
||||
bool setSourceExtensions(const std::vector<std::string>& sourceExtensions);
|
||||
|
||||
bool isUseSourcePathsForHeaderSearchDefined() const;
|
||||
bool getUseSourcePathsForHeaderSearch() const;
|
||||
bool setUseSourcePathsForHeaderSearch(bool useSourcePathsForHeaderSearch);
|
||||
|
||||
|
||||
@@ -24,6 +24,11 @@ TimePoint::TimePoint(std::string s)
|
||||
}
|
||||
}
|
||||
|
||||
TimePoint TimePoint::now()
|
||||
{
|
||||
return TimePoint(boost::posix_time::microsec_clock::local_time());
|
||||
}
|
||||
|
||||
std::string TimePoint::toString() const
|
||||
{
|
||||
std::stringstream stream;
|
||||
@@ -32,4 +37,9 @@ std::string TimePoint::toString() const
|
||||
stream.imbue(std::locale(std::locale::classic(), facet));
|
||||
stream << m_time;
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
size_t TimePoint::deltaMS(const TimePoint& other) const
|
||||
{
|
||||
return (m_time - other.m_time).total_milliseconds();
|
||||
}
|
||||
@@ -11,6 +11,8 @@ public:
|
||||
//TimePoint(time_t t);
|
||||
TimePoint(std::string s);
|
||||
|
||||
static TimePoint now();
|
||||
|
||||
std::string toString() const;
|
||||
|
||||
inline bool operator==(const TimePoint& rhs){ return m_time == rhs.m_time; }
|
||||
@@ -20,7 +22,9 @@ public:
|
||||
inline bool operator<=(const TimePoint& rhs){ return m_time <= rhs.m_time; }
|
||||
inline bool operator>=(const TimePoint& rhs){ return m_time >= rhs.m_time; }
|
||||
|
||||
inline float operator-(const TimePoint& rhs){ return (m_time - rhs.m_time).total_milliseconds() / 1000.0f; }
|
||||
inline float operator-(const TimePoint& rhs){ return deltaMS(rhs) / 1000.0f; }
|
||||
|
||||
size_t deltaMS(const TimePoint& other) const;
|
||||
|
||||
private:
|
||||
boost::posix_time::ptime m_time;
|
||||
|
||||
@@ -116,14 +116,72 @@ std::string FileSystem::getTimeStringNow() // TODO: move to utility
|
||||
return boost::posix_time::to_iso_string(boost::posix_time::second_clock::universal_time());
|
||||
}
|
||||
|
||||
bool FileSystem::exists(const std::string& path)
|
||||
bool FileSystem::exists(const FilePath& path)
|
||||
{
|
||||
return boost::filesystem::exists(boost::filesystem::path(path));
|
||||
return boost::filesystem::exists(path.path());
|
||||
}
|
||||
|
||||
bool FileSystem::remove(const std::string& path)
|
||||
bool FileSystem::remove(const FilePath& path)
|
||||
{
|
||||
return boost::filesystem::remove(path);
|
||||
return boost::filesystem::remove(path.path());
|
||||
}
|
||||
|
||||
bool FileSystem::rename(const FilePath& from, const FilePath& to)
|
||||
{
|
||||
if (!from.exists() || to.exists())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boost::filesystem::rename(from.path(), to.path());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FileSystem::copyFile(const FilePath& from, const FilePath& to)
|
||||
{
|
||||
if (!from.exists() || to.exists())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boost::filesystem::copy_file(boost::filesystem::path(from.path()), boost::filesystem::path(to.path()));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FileSystem::copy_directory(const FilePath& from, const FilePath& to)
|
||||
{
|
||||
if (!from.exists() || to.exists())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boost::filesystem::copy_directory(boost::filesystem::path(from.path()),boost::filesystem::path(to.path()));
|
||||
return true;
|
||||
}
|
||||
|
||||
void FileSystem::createDirectory(const FilePath& path)
|
||||
{
|
||||
boost::filesystem::create_directories(path.str());
|
||||
}
|
||||
|
||||
std::vector<FilePath> FileSystem::getSubDirectories(const FilePath &path)
|
||||
{
|
||||
std::vector<FilePath> v;
|
||||
|
||||
if (!path.exists())
|
||||
{
|
||||
return v;
|
||||
}
|
||||
|
||||
for (boost::filesystem::recursive_directory_iterator end, dir(path.str()); dir != end; dir++)
|
||||
{
|
||||
if (boost::filesystem::is_directory(dir->path()))
|
||||
{
|
||||
v.push_back(FilePath(dir->path()));
|
||||
}
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
std::string FileSystem::fileName(const std::string& path)
|
||||
@@ -169,38 +227,3 @@ bool FileSystem::equivalent(const std::string& pathA, const std::string& pathB)
|
||||
|
||||
return boost::filesystem::path(pathA).compare(boost::filesystem::path(pathB)) == 0;
|
||||
}
|
||||
|
||||
void FileSystem::createDirectory(const FilePath& path)
|
||||
{
|
||||
boost::filesystem::create_directories(path.str());
|
||||
}
|
||||
|
||||
bool FileSystem::copy_directory(const FilePath& from, const FilePath& to)
|
||||
{
|
||||
if(!from.exists() || to.exists())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
boost::filesystem::copy_directory(boost::filesystem::path(from.str()),boost::filesystem::path(to.str()));
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<FilePath> FileSystem::getSubDirectories(const FilePath &path)
|
||||
{
|
||||
std::vector<FilePath> v;
|
||||
|
||||
if (!path.exists())
|
||||
{
|
||||
return v;
|
||||
}
|
||||
|
||||
for (boost::filesystem::recursive_directory_iterator end, dir(path.str()); dir != end; dir++)
|
||||
{
|
||||
if (boost::filesystem::is_directory(dir->path()))
|
||||
{
|
||||
v.push_back(FilePath(dir->path()));
|
||||
}
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
@@ -23,15 +23,18 @@ public:
|
||||
static TimePoint getLastWriteTime(const FilePath& filePath);
|
||||
static std::string getTimeStringNow();
|
||||
|
||||
static bool exists(const FilePath& path);
|
||||
static bool remove(const FilePath& path);
|
||||
static bool rename(const FilePath& from, const FilePath& to);
|
||||
|
||||
static bool copyFile(const FilePath& from, const FilePath& to);
|
||||
static bool copy_directory(const FilePath& from, const FilePath& to);
|
||||
|
||||
static void createDirectory(const FilePath& path);
|
||||
static std::vector<FilePath> getSubDirectories(const FilePath& path);
|
||||
|
||||
static bool exists(const std::string& path);
|
||||
static std::string fileName(const std::string& path);
|
||||
static std::string absoluteFilePath(const std::string& path);
|
||||
static bool remove(const std::string& path);
|
||||
|
||||
static bool copy_directory(const FilePath& from, const FilePath& to);
|
||||
|
||||
static std::string extension(const std::string& path);
|
||||
static std::string filePathWithoutExtension(const std::string& path);
|
||||
|
||||
@@ -13,21 +13,21 @@
|
||||
{ \
|
||||
LogManager::getInstance()->logInfo(__str__, __FILE__, __FUNCTION__, __LINE__); \
|
||||
} \
|
||||
while(0) \
|
||||
while(0)
|
||||
|
||||
#define LOG_WARNING(__str__) \
|
||||
do \
|
||||
{ \
|
||||
LogManager::getInstance()->logWarning(__str__, __FILE__, __FUNCTION__, __LINE__); \
|
||||
} \
|
||||
while(0) \
|
||||
while(0)
|
||||
|
||||
#define LOG_ERROR(__str__) \
|
||||
do \
|
||||
{ \
|
||||
LogManager::getInstance()->logError(__str__, __FILE__, __FUNCTION__, __LINE__); \
|
||||
} \
|
||||
while(0) \
|
||||
while(0)
|
||||
|
||||
#define LOG_INFO_STREAM(__s__) \
|
||||
do \
|
||||
@@ -36,7 +36,7 @@
|
||||
__ss__ __s__; \
|
||||
LogManager::getInstance()->logInfo(__ss__.str(), __FILE__, __FUNCTION__, __LINE__); \
|
||||
} \
|
||||
while(0) \
|
||||
while(0)
|
||||
|
||||
#define LOG_WARNING_STREAM(__s__) \
|
||||
do \
|
||||
@@ -45,7 +45,7 @@
|
||||
__ss__ __s__; \
|
||||
LogManager::getInstance()->logWarning(__ss__.str(), __FILE__, __FUNCTION__, __LINE__); \
|
||||
} \
|
||||
while(0) \
|
||||
while(0)
|
||||
|
||||
#define LOG_ERROR_STREAM(__s__) \
|
||||
do \
|
||||
@@ -54,7 +54,7 @@
|
||||
__ss__ __s__; \
|
||||
LogManager::getInstance()->logError(__ss__.str(), __FILE__, __FUNCTION__, __LINE__); \
|
||||
} \
|
||||
while(0) \
|
||||
while(0)
|
||||
|
||||
#define LOG_INFO_STREAM_BARE(__s__) \
|
||||
do \
|
||||
@@ -63,6 +63,6 @@
|
||||
__ss__ __s__; \
|
||||
LogManager::getInstance()->logInfo(__ss__.str(), "", "", 0); \
|
||||
} \
|
||||
while(0) \
|
||||
while(0)
|
||||
|
||||
#endif // LOGGING_H
|
||||
|
||||
@@ -11,7 +11,6 @@ public:
|
||||
: m_isReplayed(false)
|
||||
, m_sendAsTask(true)
|
||||
, m_keepContent(false)
|
||||
, m_cancelled(false)
|
||||
, m_isLast(true)
|
||||
, m_isLogged(true)
|
||||
{
|
||||
@@ -74,16 +73,6 @@ public:
|
||||
return m_keepContent;
|
||||
}
|
||||
|
||||
void cancel()
|
||||
{
|
||||
m_cancelled = true;
|
||||
}
|
||||
|
||||
bool cancelled()
|
||||
{
|
||||
return m_cancelled;
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const = 0;
|
||||
|
||||
std::string str() const
|
||||
@@ -98,7 +87,6 @@ private:
|
||||
bool m_isReplayed;
|
||||
bool m_sendAsTask;
|
||||
bool m_keepContent;
|
||||
bool m_cancelled;
|
||||
bool m_isLast;
|
||||
bool m_isLogged;
|
||||
};
|
||||
|
||||
@@ -253,11 +253,6 @@ void MessageQueue::sendMessage(std::shared_ptr<MessageBase> message)
|
||||
listener->handleMessageBase(message.get());
|
||||
m_listenersMutex.lock();
|
||||
}
|
||||
|
||||
if (message->cancelled())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,7 +272,7 @@ void MessageQueue::sendMessageAsTask(std::shared_ptr<MessageBase> message, bool
|
||||
[listenerId, message]()
|
||||
{
|
||||
MessageListenerBase* listener = MessageQueue::getInstance()->getListenerById(listenerId);
|
||||
if (listener && !message->cancelled())
|
||||
if (listener)
|
||||
{
|
||||
listener->handleMessageBase(message.get());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef MESSAGE_COLOR_SCHEME_TEST_H
|
||||
#define MESSAGE_COLOR_SCHEME_TEST_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageColorSchemeTest
|
||||
: public Message<MessageColorSchemeTest>
|
||||
{
|
||||
public:
|
||||
MessageColorSchemeTest()
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageColorSchemeTest";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // MESSAGE_COLOR_SCHEME_TEST_H
|
||||
@@ -25,11 +25,6 @@ public:
|
||||
return "MessageFinishedParsing";
|
||||
}
|
||||
|
||||
virtual void dispatch()
|
||||
{
|
||||
Message<MessageFinishedParsing>::dispatch();
|
||||
}
|
||||
|
||||
std::string getStatusStr() const
|
||||
{
|
||||
if (loadedOnly)
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#ifndef MESSAGE_LOAD_PROJECT_H
|
||||
#define MESSAGE_LOAD_PROJECT_H
|
||||
|
||||
#include "utility/file/FilePath.h"
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageLoadProject: public Message<MessageLoadProject>
|
||||
class MessageLoadProject
|
||||
: public Message<MessageLoadProject>
|
||||
{
|
||||
public:
|
||||
MessageLoadProject(const std::string& filePath, bool forceRefresh)
|
||||
MessageLoadProject(const FilePath& filePath, bool forceRefresh)
|
||||
: projectSettingsFilePath(filePath)
|
||||
, forceRefresh(forceRefresh)
|
||||
{
|
||||
@@ -19,10 +21,10 @@ public:
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
{
|
||||
os << projectSettingsFilePath << ", forceRefresh: " << std::boolalpha << forceRefresh;
|
||||
os << projectSettingsFilePath.str() << ", forceRefresh: " << std::boolalpha << forceRefresh;
|
||||
}
|
||||
|
||||
const std::string projectSettingsFilePath;
|
||||
const FilePath projectSettingsFilePath;
|
||||
const bool forceRefresh;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#ifndef MESSAGE_SAVE_PROJECT_H
|
||||
#define MESSAGE_SAVE_PROJECT_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageSaveProject: public Message<MessageSaveProject>
|
||||
{
|
||||
public:
|
||||
MessageSaveProject(const std::string& filePath)
|
||||
: projectSettingsFilePath(filePath)
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageSaveProject";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
{
|
||||
os << projectSettingsFilePath;
|
||||
}
|
||||
|
||||
const std::string projectSettingsFilePath;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_SAVE_PROJECT_H
|
||||
@@ -27,63 +27,62 @@ Task::TaskState Task::getState() const
|
||||
return m_state;
|
||||
}
|
||||
|
||||
Task::TaskState Task::process(bool interruptTask)
|
||||
Task::TaskState Task::processTask()
|
||||
{
|
||||
if (interruptTask)
|
||||
switch (m_state)
|
||||
{
|
||||
switch (m_state)
|
||||
case STATE_NEW:
|
||||
case STATE_CANCELED:
|
||||
enter();
|
||||
case STATE_RUNNING:
|
||||
{
|
||||
case STATE_NEW:
|
||||
case STATE_CANCELED:
|
||||
break;
|
||||
case STATE_RUNNING:
|
||||
interrupt();
|
||||
exit();
|
||||
break;
|
||||
case STATE_FINISHED:
|
||||
revert();
|
||||
break;
|
||||
}
|
||||
|
||||
setState(STATE_CANCELED);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (m_state)
|
||||
{
|
||||
case STATE_NEW:
|
||||
case STATE_CANCELED:
|
||||
enter();
|
||||
case STATE_RUNNING:
|
||||
TaskState newState = update();
|
||||
if (newState == STATE_NEW || newState == STATE_CANCELED)
|
||||
{
|
||||
TaskState newState = update();
|
||||
if (newState == STATE_NEW || newState == STATE_CANCELED)
|
||||
{
|
||||
LOG_ERROR("Task can't change to state NEW or CANCELLED");
|
||||
return m_state;
|
||||
}
|
||||
LOG_ERROR("Task can't change to state NEW or CANCELLED");
|
||||
return m_state;
|
||||
}
|
||||
|
||||
setState(newState);
|
||||
if (m_state == STATE_FINISHED)
|
||||
{
|
||||
exit();
|
||||
}
|
||||
setState(newState);
|
||||
if (m_state == STATE_FINISHED)
|
||||
{
|
||||
exit();
|
||||
}
|
||||
break;
|
||||
case STATE_FINISHED:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case STATE_FINISHED:
|
||||
break;
|
||||
}
|
||||
|
||||
return m_state;
|
||||
}
|
||||
|
||||
void Task::execute()
|
||||
Task::TaskState Task::interruptTask()
|
||||
{
|
||||
switch (m_state)
|
||||
{
|
||||
case STATE_NEW:
|
||||
case STATE_CANCELED:
|
||||
break;
|
||||
case STATE_RUNNING:
|
||||
interrupt();
|
||||
exit();
|
||||
break;
|
||||
case STATE_FINISHED:
|
||||
revert();
|
||||
break;
|
||||
}
|
||||
|
||||
setState(STATE_CANCELED);
|
||||
return m_state;
|
||||
}
|
||||
|
||||
void Task::executeTask()
|
||||
{
|
||||
TaskState state;
|
||||
do
|
||||
{
|
||||
state = process(false);
|
||||
state = processTask();
|
||||
}
|
||||
while (state != STATE_FINISHED);
|
||||
}
|
||||
|
||||
@@ -22,8 +22,10 @@ public:
|
||||
|
||||
TaskState getState() const;
|
||||
|
||||
TaskState process(bool interruptTask);
|
||||
void execute();
|
||||
TaskState processTask();
|
||||
TaskState interruptTask();
|
||||
|
||||
void executeTask();
|
||||
|
||||
virtual void enter() = 0;
|
||||
virtual TaskState update() = 0;
|
||||
|
||||
@@ -21,7 +21,7 @@ Task::TaskState TaskGroupParallel::update()
|
||||
{
|
||||
for (size_t i = 0; i < m_tasks.size(); i++)
|
||||
{
|
||||
m_threads.push_back(std::thread(&TaskGroupParallel::processTask, this, m_tasks[i]));
|
||||
m_threads.push_back(std::thread(&TaskGroupParallel::processTaskThreaded, this, m_tasks[i]));
|
||||
|
||||
std::lock_guard<std::mutex> lock(m_activeTaskCountMutex);
|
||||
m_activeTaskCount++;
|
||||
@@ -63,12 +63,19 @@ void TaskGroupParallel::revert()
|
||||
}
|
||||
|
||||
|
||||
void TaskGroupParallel::processTask(std::shared_ptr<Task> task)
|
||||
void TaskGroupParallel::processTaskThreaded(std::shared_ptr<Task> task)
|
||||
{
|
||||
Task::TaskState state = Task::STATE_NEW;
|
||||
while (state != Task::STATE_FINISHED && state != Task::STATE_CANCELED)
|
||||
{
|
||||
state = task->process(m_interrupt);
|
||||
if (m_interrupt)
|
||||
{
|
||||
state = task->interruptTask();
|
||||
}
|
||||
else
|
||||
{
|
||||
state = task->processTask();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
virtual void revert();
|
||||
|
||||
private:
|
||||
void processTask(std::shared_ptr<Task> task);
|
||||
void processTaskThreaded(std::shared_ptr<Task> task);
|
||||
|
||||
volatile bool m_interrupt;
|
||||
bool m_running;
|
||||
|
||||
@@ -27,7 +27,7 @@ Task::TaskState TaskGroupSequential::update()
|
||||
|
||||
std::shared_ptr<Task> task = m_tasks[m_taskIndex];
|
||||
|
||||
TaskState state = task->process(false);
|
||||
TaskState state = task->processTask();
|
||||
|
||||
if (state == Task::STATE_FINISHED && size_t(m_taskIndex + 1) == m_tasks.size())
|
||||
{
|
||||
@@ -47,7 +47,7 @@ void TaskGroupSequential::interrupt()
|
||||
{
|
||||
for (int i = m_taskIndex; i >= 0; i--)
|
||||
{
|
||||
m_tasks[i]->process(true);
|
||||
m_tasks[i]->interruptTask();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,6 @@ void TaskGroupSequential::revert()
|
||||
{
|
||||
for (int i = m_tasks.size() - 1; i >= 0; i--)
|
||||
{
|
||||
m_tasks[i]->process(true);
|
||||
m_tasks[i]->interruptTask();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ void TaskScheduler::startSchedulerLoop()
|
||||
|
||||
while (true)
|
||||
{
|
||||
updateTasks();
|
||||
processTasks();
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_loopMutex);
|
||||
@@ -141,26 +141,33 @@ TaskScheduler::TaskScheduler()
|
||||
{
|
||||
}
|
||||
|
||||
void TaskScheduler::updateTasks()
|
||||
void TaskScheduler::processTasks()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_tasksMutex);
|
||||
|
||||
bool interrupt = m_interruptTask;
|
||||
|
||||
while (m_tasks.size())
|
||||
{
|
||||
bool interrupt = m_interruptTask;
|
||||
m_interruptTask = false;
|
||||
|
||||
std::shared_ptr<Task> task = m_tasks.front();
|
||||
Task::TaskState state;
|
||||
|
||||
m_tasksMutex.unlock();
|
||||
Task::TaskState state = task->process(interrupt);
|
||||
if (interrupt)
|
||||
{
|
||||
state = task->interruptTask();
|
||||
}
|
||||
else
|
||||
{
|
||||
state = task->processTask();
|
||||
}
|
||||
m_tasksMutex.lock();
|
||||
|
||||
if (state == Task::STATE_FINISHED || state == Task::STATE_CANCELED)
|
||||
{
|
||||
m_tasks.pop_front();
|
||||
}
|
||||
|
||||
interrupt = m_interruptTask;
|
||||
}
|
||||
|
||||
m_interruptTask = false;
|
||||
|
||||
@@ -33,7 +33,7 @@ private:
|
||||
TaskScheduler(const TaskScheduler&);
|
||||
void operator=(const TaskScheduler&);
|
||||
|
||||
void updateTasks();
|
||||
void processTasks();
|
||||
|
||||
virtual void handleMessage(MessageInterruptTasks* message);
|
||||
|
||||
|
||||
@@ -345,6 +345,28 @@ std::vector<std::string> SolutionParserUtility::makePathsCanonical(const std::ve
|
||||
return canonicalPaths;
|
||||
}
|
||||
|
||||
std::string SolutionParserUtility::makePathCanonical(const std::string& path)
|
||||
{
|
||||
std::string result = "";
|
||||
|
||||
try
|
||||
{
|
||||
boost::filesystem::path canonicalPath = boost::filesystem::canonical(boost::filesystem::path(path));
|
||||
result = canonicalPath.string();
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
std::string what = e.what();
|
||||
LOG_WARNING_STREAM(<< e.what());
|
||||
|
||||
std::stringstream errorMessage;
|
||||
errorMessage << "Could not make path \"" << path << "\" canonical. Check if it really exists.";
|
||||
MessageStatus(errorMessage.str(), true).dispatch();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string SolutionParserUtility::checkIsIdeMacro(const std::string& text)
|
||||
{
|
||||
for (unsigned int i = 0; i < m_ideMacros.size(); i++)
|
||||
|
||||
@@ -21,6 +21,7 @@ public:
|
||||
static std::vector<std::string> resolveEnvironmentVariables(const std::vector<std::string>& paths);
|
||||
static std::string findAndResolveEnvironmentVariable(const std::string& path);
|
||||
static std::vector<std::string> makePathsCanonical(const std::vector<std::string>& paths);
|
||||
static std::string makePathCanonical(const std::string& path);
|
||||
|
||||
static std::string checkIsIdeMacro(const std::string& text); // returns matching macro or empty string if no match was found
|
||||
|
||||
|
||||
@@ -340,6 +340,8 @@ std::vector<std::string> SolutionParserVisualStudio::findProjectItems()
|
||||
continue;
|
||||
}
|
||||
|
||||
setProjectMacros(projectFilesNames[i]);
|
||||
|
||||
TiXmlElement* root = SolutionParserUtility::getFirstTagByNameWithAttribute(doc.RootElement(), "ClCompile", "Include");
|
||||
TiXmlElement* headerRoot = SolutionParserUtility::getFirstTagByNameWithAttribute(doc.RootElement(), "ClInclude", "Include");
|
||||
if (root != NULL)
|
||||
@@ -394,7 +396,7 @@ std::vector<std::string> SolutionParserVisualStudio::findProjectItems()
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
std::vector<std::string> filePaths;
|
||||
|
||||
if (root != NULL)
|
||||
{
|
||||
@@ -404,7 +406,7 @@ std::vector<std::string> SolutionParserVisualStudio::findProjectItems()
|
||||
|
||||
if (boost::filesystem::exists(filePath) && SolutionParserUtility::checkValidFileExtension(filePath, validFileExtensions))
|
||||
{
|
||||
projectItems.push_back(filePath);
|
||||
filePaths.push_back(filePath);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -415,7 +417,7 @@ std::vector<std::string> SolutionParserVisualStudio::findProjectItems()
|
||||
|
||||
if (SolutionParserUtility::checkValidFileExtension(filePath, validFileExtensions))
|
||||
{
|
||||
projectItems.push_back(filePath);
|
||||
filePaths.push_back(filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -428,7 +430,7 @@ std::vector<std::string> SolutionParserVisualStudio::findProjectItems()
|
||||
|
||||
if (boost::filesystem::exists(filePath) && SolutionParserUtility::checkValidFileExtension(filePath, validFileExtensions))
|
||||
{
|
||||
projectItems.push_back(filePath);
|
||||
filePaths.push_back(filePath);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -439,10 +441,20 @@ std::vector<std::string> SolutionParserVisualStudio::findProjectItems()
|
||||
|
||||
if (SolutionParserUtility::checkValidFileExtension(filePath, validFileExtensions))
|
||||
{
|
||||
projectItems.push_back(filePath);
|
||||
filePaths.push_back(filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::set<std::string> s(filePaths.begin(), filePaths.end());
|
||||
filePaths.assign(s.begin(), s.end());
|
||||
|
||||
filePaths = SolutionParserUtility::resolveEnvironmentVariables(filePaths);
|
||||
|
||||
for (unsigned int j = 0; j < filePaths.size(); j++)
|
||||
{
|
||||
projectItems.push_back(filePaths[j]);
|
||||
}
|
||||
}
|
||||
|
||||
std::set<std::string> s(projectItems.begin(), projectItems.end());
|
||||
@@ -450,7 +462,7 @@ std::vector<std::string> SolutionParserVisualStudio::findProjectItems()
|
||||
|
||||
LOG_INFO_STREAM(<< "Found " << projectItems.size() << " code files");
|
||||
|
||||
projectItems = SolutionParserUtility::resolveEnvironmentVariables(projectItems);
|
||||
// projectItems = SolutionParserUtility::resolveEnvironmentVariables(projectItems);
|
||||
projectItems = makePathsAbsolute(projectItems);
|
||||
|
||||
return projectItems;
|
||||
@@ -461,6 +473,7 @@ std::vector<std::string> SolutionParserVisualStudio::findIncludePaths()
|
||||
std::vector<std::string> includePaths;
|
||||
|
||||
std::vector<std::string> projectFiles = getProjectFiles();
|
||||
std::vector<std::string> projectFilesNames = getProjects();
|
||||
|
||||
std::vector<std::string> validExtensions;
|
||||
validExtensions.push_back(".c");
|
||||
@@ -475,6 +488,8 @@ std::vector<std::string> SolutionParserVisualStudio::findIncludePaths()
|
||||
TiXmlDocument doc;
|
||||
doc.Parse(projectFiles[i].c_str(), 0, TIXML_ENCODING_UTF8);
|
||||
|
||||
setProjectMacros(projectFilesNames[i]);
|
||||
|
||||
std::string error = doc.ErrorDesc();
|
||||
|
||||
if (error.length() > 0)
|
||||
@@ -485,22 +500,36 @@ std::vector<std::string> SolutionParserVisualStudio::findIncludePaths()
|
||||
|
||||
std::vector<TiXmlElement*> nodes = SolutionParserUtility::getAllTagsByName(doc.RootElement(), "AdditionalIncludeDirectories");
|
||||
|
||||
std::vector<std::string> paths;
|
||||
|
||||
for (unsigned int j = 0; j < nodes.size(); j++)
|
||||
{
|
||||
std::string path = nodes[j]->GetText();
|
||||
|
||||
includePaths.push_back(path);
|
||||
paths.push_back(path);
|
||||
}
|
||||
|
||||
paths = seperateIncludePaths(paths);
|
||||
|
||||
std::set<std::string> s(paths.begin(), paths.end());
|
||||
paths.assign(s.begin(), s.end());
|
||||
|
||||
paths = SolutionParserUtility::resolveEnvironmentVariables(paths);
|
||||
|
||||
for (unsigned int j = 0; j < paths.size(); j++)
|
||||
{
|
||||
includePaths.push_back(paths[j]);
|
||||
}
|
||||
}
|
||||
|
||||
includePaths = seperateIncludePaths(includePaths);
|
||||
// includePaths = seperateIncludePaths(includePaths);
|
||||
|
||||
std::set<std::string> s(includePaths.begin(), includePaths.end());
|
||||
includePaths.assign(s.begin(), s.end());
|
||||
|
||||
LOG_INFO_STREAM(<< "Found " << includePaths.size() << " additional include paths");
|
||||
|
||||
includePaths = SolutionParserUtility::resolveEnvironmentVariables(includePaths);
|
||||
// includePaths = SolutionParserUtility::resolveEnvironmentVariables(includePaths);
|
||||
includePaths = makePathsAbsolute(includePaths);
|
||||
|
||||
return includePaths;
|
||||
@@ -638,3 +667,55 @@ std::vector<std::string> SolutionParserVisualStudio::seperateCompilerFlags(const
|
||||
|
||||
return seperatedFlags;
|
||||
}
|
||||
|
||||
void SolutionParserVisualStudio::setProjectMacros(const std::string& projectName)
|
||||
{
|
||||
std::string solutionPath = getSolutionPath();
|
||||
|
||||
std::string projectNameBase = projectName;
|
||||
|
||||
std::replace(solutionPath.begin(), solutionPath.end(), '/', '\\');
|
||||
std::replace(projectNameBase.begin(), projectNameBase.end(), '/', '\\');
|
||||
|
||||
std::string projectPath = solutionPath + projectNameBase;
|
||||
|
||||
std::string projectDirectory = "";
|
||||
std::string projectNameOnly = "";
|
||||
|
||||
size_t pos = projectNameBase.find_last_of('\\');
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
projectDirectory = projectNameBase.substr(0, pos);
|
||||
projectNameOnly = projectNameBase.substr(pos + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
projectNameOnly = projectNameBase;
|
||||
}
|
||||
|
||||
std::string projectExtension = "";
|
||||
|
||||
pos = projectNameOnly.find_last_of('.');
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
projectExtension = projectNameOnly.substr(pos + 1);
|
||||
projectNameOnly = projectNameOnly.substr(0, pos);
|
||||
}
|
||||
|
||||
projectPath = SolutionParserUtility::findAndResolveEnvironmentVariable(projectPath);
|
||||
projectPath = SolutionParserUtility::makePathCanonical(projectPath);
|
||||
|
||||
std::string projectDir = "";
|
||||
|
||||
pos = projectPath.find_last_of('\\');
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
projectDir = projectPath.substr(0, pos+1);
|
||||
}
|
||||
|
||||
SolutionParserUtility::m_ideMacroValues["ProjectDir"] = projectDir;
|
||||
SolutionParserUtility::m_ideMacroValues["ProjectPath"] = projectPath;
|
||||
SolutionParserUtility::m_ideMacroValues["ProjectName"] = projectNameOnly;
|
||||
SolutionParserUtility::m_ideMacroValues["ProjectFileName"] = projectNameOnly + "." + projectExtension;
|
||||
SolutionParserUtility::m_ideMacroValues["ProjectExt"] = projectExtension;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,8 @@ private:
|
||||
std::vector<std::string> seperateCompilerFlags(const std::vector<std::string>& compilerFlags) const;
|
||||
std::vector<std::string> seperateCompilerFlags(const std::string& compilerFlags) const;
|
||||
|
||||
void setProjectMacros(const std::string& projectName);
|
||||
|
||||
std::vector<std::string> m_compatibilityFlags;
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
#include "utility/tracing.h"
|
||||
|
||||
#include "utility/utility.h"
|
||||
|
||||
std::shared_ptr<Tracer> Tracer::s_instance;
|
||||
Id Tracer::s_nextTraceId = 0;
|
||||
|
||||
Tracer* Tracer::getInstance()
|
||||
{
|
||||
if (!s_instance)
|
||||
{
|
||||
s_instance = std::shared_ptr<Tracer>(new Tracer());
|
||||
}
|
||||
|
||||
return s_instance.get();
|
||||
}
|
||||
|
||||
TraceEvent* Tracer::startEvent(const std::string& eventName)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
std::thread::id id = std::this_thread::get_id();
|
||||
std::shared_ptr<TraceEvent> event =
|
||||
std::make_shared<TraceEvent>(eventName, s_nextTraceId++, m_startedEvents[id].size());
|
||||
|
||||
m_events[id].push_back(event);
|
||||
m_startedEvents[id].push(event.get());
|
||||
|
||||
return event.get();
|
||||
}
|
||||
|
||||
void Tracer::finishEvent(TraceEvent* event)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
std::thread::id id = std::this_thread::get_id();
|
||||
m_startedEvents[id].pop();
|
||||
}
|
||||
|
||||
void Tracer::printTraces()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
size_t unfinishEvents = 0;
|
||||
for (auto p : m_startedEvents)
|
||||
{
|
||||
unfinishEvents += p.second.size();
|
||||
}
|
||||
|
||||
if (unfinishEvents > 0)
|
||||
{
|
||||
std::cout << "TRACING: Trace events are still running." << std::endl;
|
||||
return;
|
||||
}
|
||||
else if (!m_events.size())
|
||||
{
|
||||
std::cout << "TRACING: No trace events collected." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::cout << "TRACING\n--------------------------\n" << std::endl;
|
||||
|
||||
std::cout << "HISTORY:\n\n";
|
||||
std::cout << " time name function";
|
||||
std::cout << " location\n";
|
||||
std::cout << "-----------------------------------------------------------------";
|
||||
std::cout << "------------------------------------------------------------\n";
|
||||
|
||||
for (auto p : m_events)
|
||||
{
|
||||
std::cout << "thread: " << p.first << std::endl;
|
||||
|
||||
for (const std::shared_ptr<TraceEvent> event : p.second)
|
||||
{
|
||||
std::cout.width(8 + 2 * event->depth);
|
||||
std::cout << std::right << std::setprecision(3) << std::fixed << event->time;
|
||||
|
||||
std::cout.width(17 - 2 * event->depth);
|
||||
std::cout << " ";
|
||||
|
||||
std::cout.width(25);
|
||||
std::cout << std::left << event->eventName;
|
||||
|
||||
std::cout.width(50);
|
||||
std::cout << (event->functionName + "()") << event->locationName << std::endl;
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
std::cout << "\nREPORT:\n\n";
|
||||
std::cout << " time count name function";
|
||||
std::cout << " location\n";
|
||||
std::cout << "-----------------------------------------------------------------";
|
||||
std::cout << "------------------------------------------------------------\n";
|
||||
|
||||
struct AccumulatedTraceEvent
|
||||
{
|
||||
TraceEvent* event;
|
||||
size_t count;
|
||||
float time;
|
||||
};
|
||||
|
||||
std::map<std::string, AccumulatedTraceEvent> accumulatedEvents;
|
||||
|
||||
for (auto p : m_events)
|
||||
{
|
||||
for (const std::shared_ptr<TraceEvent> event : p.second)
|
||||
{
|
||||
std::string name = event->eventName + event->functionName + event->locationName;
|
||||
|
||||
std::pair<std::map<std::string, AccumulatedTraceEvent>::iterator, bool> p =
|
||||
accumulatedEvents.emplace(name, AccumulatedTraceEvent());
|
||||
|
||||
AccumulatedTraceEvent* acc = &p.first->second;
|
||||
if (p.second)
|
||||
{
|
||||
acc->event = event.get();
|
||||
acc->time = event->time;
|
||||
acc->count = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
acc->time += event->time;
|
||||
acc->count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::multiset<AccumulatedTraceEvent,
|
||||
std::function<bool (const AccumulatedTraceEvent&, const AccumulatedTraceEvent&)>> sortedEvents(
|
||||
[](const AccumulatedTraceEvent& a, const AccumulatedTraceEvent& b)
|
||||
{
|
||||
return a.time > b.time;
|
||||
}
|
||||
);
|
||||
|
||||
for (const std::pair<std::string, AccumulatedTraceEvent> p : accumulatedEvents)
|
||||
{
|
||||
sortedEvents.insert(p.second);
|
||||
}
|
||||
|
||||
for (const AccumulatedTraceEvent& acc : sortedEvents)
|
||||
{
|
||||
std::cout.width(8);
|
||||
std::cout << std::right << std::setprecision(3) << std::fixed << acc.time;
|
||||
|
||||
std::cout.width(10);
|
||||
std::cout << acc.count << " ";
|
||||
|
||||
std::cout.width(25);
|
||||
std::cout << std::left << acc.event->eventName;
|
||||
|
||||
std::cout.width(50);
|
||||
std::cout << (acc.event->functionName + "()") << acc.event->locationName << std::endl;
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
|
||||
m_events.clear();
|
||||
}
|
||||
|
||||
Tracer::Tracer()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ScopedTrace::ScopedTrace(
|
||||
const std::string& eventName, const std::string& fileName, int lineNumber, const std::string& functionName)
|
||||
{
|
||||
m_event = Tracer::getInstance()->startEvent(eventName);
|
||||
m_event->functionName = functionName;
|
||||
m_event->locationName = FilePath(fileName).fileName() + ":" + std::to_string(lineNumber);
|
||||
|
||||
m_timePoint = utility::durationStart();
|
||||
}
|
||||
|
||||
ScopedTrace::~ScopedTrace()
|
||||
{
|
||||
m_event->time = utility::duration(m_timePoint);
|
||||
Tracer::getInstance()->finishEvent(m_event);
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
#ifndef TRACING_H
|
||||
#define TRACING_H
|
||||
|
||||
#include <mutex>
|
||||
#include <stack>
|
||||
#include <thread>
|
||||
|
||||
#include "utility/TimePoint.h"
|
||||
#include "utility/types.h"
|
||||
|
||||
struct TraceEvent
|
||||
{
|
||||
public:
|
||||
TraceEvent(const std::string& eventName, Id id, size_t depth)
|
||||
: eventName(eventName)
|
||||
, id(id)
|
||||
, depth(depth)
|
||||
, time(0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
const std::string eventName;
|
||||
const Id id;
|
||||
const size_t depth;
|
||||
|
||||
std::string functionName;
|
||||
std::string locationName;
|
||||
|
||||
float time;
|
||||
};
|
||||
|
||||
|
||||
class Tracer
|
||||
{
|
||||
public:
|
||||
static Tracer* getInstance();
|
||||
|
||||
TraceEvent* startEvent(const std::string& eventName);
|
||||
void finishEvent(TraceEvent* event);
|
||||
|
||||
void printTraces();
|
||||
|
||||
private:
|
||||
static std::shared_ptr<Tracer> s_instance;
|
||||
static Id s_nextTraceId;
|
||||
|
||||
Tracer();
|
||||
Tracer(const Tracer&);
|
||||
void operator=(const Tracer&);
|
||||
|
||||
std::map<std::thread::id, std::vector<std::shared_ptr<TraceEvent>>> m_events;
|
||||
std::map<std::thread::id, std::stack<TraceEvent*>> m_startedEvents;
|
||||
|
||||
std::mutex m_mutex;
|
||||
};
|
||||
|
||||
|
||||
class ScopedTrace
|
||||
{
|
||||
public:
|
||||
ScopedTrace(const std::string& eventName, const std::string& fileName, int lineNumber, const std::string& functionName);
|
||||
~ScopedTrace();
|
||||
|
||||
private:
|
||||
TraceEvent* m_event;
|
||||
TimePoint m_timePoint;
|
||||
};
|
||||
|
||||
|
||||
// #define TRACING_ENABLED
|
||||
|
||||
#ifdef TRACING_ENABLED
|
||||
#define TRACE(__name__) \
|
||||
ScopedTrace __trace__(std::string(__name__), __FILE__, __LINE__, __FUNCTION__)
|
||||
|
||||
#define PRINT_TRACES() \
|
||||
Tracer::getInstance()->printTraces()
|
||||
#else
|
||||
#define TRACE(__name__)
|
||||
#define PRINT_TRACES()
|
||||
#endif
|
||||
|
||||
#endif // TRACING_H
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
TimePoint utility::durationStart()
|
||||
{
|
||||
return TimePoint(boost::posix_time::microsec_clock::local_time());
|
||||
return TimePoint::now();
|
||||
}
|
||||
|
||||
float utility::duration(const TimePoint& start)
|
||||
|
||||
@@ -34,6 +34,9 @@ namespace utility
|
||||
template<typename T>
|
||||
void append(std::unordered_set<T>& a, const std::unordered_set<T>& b);
|
||||
|
||||
template<typename T>
|
||||
std::vector<T> unique(const std::vector<T>& a);
|
||||
|
||||
template<typename T>
|
||||
std::vector<T> toVector(const std::deque<T>& d);
|
||||
|
||||
@@ -86,6 +89,29 @@ void utility::append(std::unordered_set<T>& a, const std::unordered_set<T>& b)
|
||||
a.insert(b.begin(), b.end());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::vector<T> utility::unique(const std::vector<T>& a)
|
||||
{
|
||||
std::map<T, size_t> unique;
|
||||
|
||||
size_t i = 0;
|
||||
for (const T& t : a)
|
||||
{
|
||||
if (unique.emplace(t, i).second)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<T> r(i, T());
|
||||
for (const std::pair<T, size_t>& p : unique)
|
||||
{
|
||||
r[p.second] = p.first;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::vector<T> utility::toVector(const std::deque<T>& d)
|
||||
{
|
||||
|
||||
@@ -52,6 +52,8 @@ add_files(
|
||||
qt/network/QtTcpWrapper.cpp
|
||||
qt/network/QtTcpWrapper.h
|
||||
|
||||
qt/utility/QtContextMenu.cpp
|
||||
qt/utility/QtContextMenu.h
|
||||
qt/utility/QtDeviceScaledPixmap.cpp
|
||||
qt/utility/QtDeviceScaledPixmap.h
|
||||
qt/utility/QtHighlighter.cpp
|
||||
@@ -100,6 +102,8 @@ add_files(
|
||||
qt/view/QtUndoRedoView.h
|
||||
qt/view/QtViewFactory.cpp
|
||||
qt/view/QtViewFactory.h
|
||||
qt/view/QtViewOverlay.cpp
|
||||
qt/view/QtViewOverlay.h
|
||||
qt/view/QtViewWidgetWrapper.cpp
|
||||
qt/view/QtViewWidgetWrapper.h
|
||||
|
||||
|
||||
@@ -120,7 +120,11 @@ void QtAutocompletionDelegate::paint(QPainter* painter, const QStyleOptionViewIt
|
||||
|
||||
float charWidth = option.fontMetrics.width(
|
||||
"----------------------------------------------------------------------------------------------------"
|
||||
) / 100.0f;
|
||||
"----------------------------------------------------------------------------------------------------"
|
||||
"----------------------------------------------------------------------------------------------------"
|
||||
"----------------------------------------------------------------------------------------------------"
|
||||
"----------------------------------------------------------------------------------------------------"
|
||||
) / 500.0f;
|
||||
painter->drawText(option.rect.adjusted(charWidth + 2, -1, 0, 0), Qt::AlignLeft, name);
|
||||
|
||||
QString highlightName(name.size(), ' ');
|
||||
@@ -173,11 +177,11 @@ void QtAutocompletionDelegate::paint(QPainter* painter, const QStyleOptionViewIt
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
QSize QtAutocompletionDelegate::sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const
|
||||
QSize QtAutocompletionDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const
|
||||
{
|
||||
QString name = index.data().toString();
|
||||
QString type = index.sibling(index.row(), index.column() + 1).data().toString();
|
||||
return QSize( option.fontMetrics.width(name+type)+5, option.fontMetrics.height());
|
||||
return QSize(option.fontMetrics.width(name + type) + 5, option.fontMetrics.height());
|
||||
}
|
||||
|
||||
QtAutocompletionList::QtAutocompletionList(QWidget* parent)
|
||||
@@ -196,44 +200,34 @@ QtAutocompletionList::QtAutocompletionList(QWidget* parent)
|
||||
setPopup(list);
|
||||
|
||||
setCaseSensitivity(Qt::CaseInsensitive);
|
||||
// setCompletionMode(QCompleter::UnfilteredPopupCompletion);
|
||||
setCompletionMode(QCompleter::UnfilteredPopupCompletion);
|
||||
setModelSorting(QCompleter::UnsortedModel);
|
||||
setCompletionPrefix("");
|
||||
setMaxVisibleItems(20);
|
||||
}
|
||||
|
||||
QtAutocompletionList::~QtAutocompletionList()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void QtAutocompletionList::completeAt(const QPoint& pos, const std::vector<SearchMatch>& autocompletionList)
|
||||
{
|
||||
m_model->setMatchList(autocompletionList);
|
||||
|
||||
QSize minSize(400, 253);
|
||||
QListView* list = dynamic_cast<QListView*>(popup());
|
||||
|
||||
if (!autocompletionList.size())
|
||||
{
|
||||
list->hide();
|
||||
return;
|
||||
}
|
||||
|
||||
setCompletionPrefix("");
|
||||
|
||||
const QModelIndex& index = completionModel()->index(0, 0);
|
||||
list->setCurrentIndex(index);
|
||||
|
||||
QRect rect = list->visualRect(index);
|
||||
minSize.setHeight(std::min(minSize.height(), m_model->rowCount(index) * rect.height() + 16));
|
||||
|
||||
list->setMinimumSize(minSize);
|
||||
list->verticalScrollBar()->setValue(list->verticalScrollBar()->minimum());
|
||||
|
||||
disconnect(); // must be done because of a bug where signals are no longer received by QtSmartSearchBox
|
||||
connect(this, SIGNAL(highlighted(const QModelIndex&)), this, SLOT(onHighlighted(const QModelIndex&)), Qt::DirectConnection);
|
||||
connect(this, SIGNAL(activated(const QModelIndex&)), this, SLOT(onActivated(const QModelIndex&)), Qt::DirectConnection);
|
||||
|
||||
QWidget* textBox = dynamic_cast<QWidget*>(parent());
|
||||
complete(QRect(pos.x(), pos.y(), textBox->width(), 1));
|
||||
complete(QRect(pos.x(), pos.y(), std::max(dynamic_cast<QWidget*>(parent())->width(), 400), 1));
|
||||
|
||||
list->setCurrentIndex(completionModel()->index(0, 0));
|
||||
}
|
||||
|
||||
const SearchMatch* QtAutocompletionList::getSearchMatchAt(int idx) const
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
virtual ~QtAutocompletionDelegate();
|
||||
|
||||
virtual void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
||||
virtual QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const;
|
||||
virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "data/location/TokenLocationFile.h"
|
||||
#include "qt/element/QtCodeFile.h"
|
||||
#include "qt/element/QtCodeSnippet.h"
|
||||
#include "qt/utility/QtContextMenu.h"
|
||||
#include "qt/utility/QtHighlighter.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "settings/ColorScheme.h"
|
||||
@@ -97,6 +98,7 @@ QtCodeArea::QtCodeArea(
|
||||
, m_isActiveFile(false)
|
||||
, m_lineNumbersHidden(false)
|
||||
, m_wasAnnotated(false)
|
||||
, m_endTextEditPosition(0)
|
||||
{
|
||||
setObjectName("code_area");
|
||||
setReadOnly(true);
|
||||
@@ -116,6 +118,7 @@ QtCodeArea::QtCodeArea(
|
||||
}
|
||||
|
||||
setPlainText(QString::fromUtf8(displayCode.c_str()));
|
||||
createLineLengthCache();
|
||||
|
||||
m_digits = lineNumberDigits();
|
||||
updateLineNumberAreaWidth();
|
||||
@@ -498,10 +501,7 @@ void QtCodeArea::contextMenuEvent(QContextMenuEvent* event)
|
||||
if (m_setIDECursorPositionAction != nullptr)
|
||||
{
|
||||
m_eventPosition = event->pos();
|
||||
|
||||
QMenu menu(this);
|
||||
menu.addAction(m_setIDECursorPositionAction);
|
||||
menu.exec(event->globalPos());
|
||||
QtContextMenu::getInstance()->showExtended(event, this, std::vector<QAction*>(1, m_setIDECursorPositionAction));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -658,7 +658,7 @@ void QtCodeArea::createAnnotations(std::shared_ptr<TokenLocationFile> locationFi
|
||||
{
|
||||
annotation.end = endTextEditPosition();
|
||||
annotation.endLine = endLineNumber;
|
||||
annotation.endCol = document()->findBlockByLineNumber(document()->blockCount() - 1).length();
|
||||
annotation.endCol = m_lineLengths[document()->blockCount() - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -772,7 +772,7 @@ int QtCodeArea::toTextEditPosition(int lineNumber, int columnNumber) const
|
||||
|
||||
for (int i = 0; i < lineNumber - 1; i++)
|
||||
{
|
||||
position += document()->findBlockByLineNumber(i).length();
|
||||
position += m_lineLengths[i];
|
||||
}
|
||||
|
||||
position += columnNumber;
|
||||
@@ -784,7 +784,7 @@ std::pair<int, int> QtCodeArea::toLineColumn(int textEditPosition) const
|
||||
int lineNumber = m_startLineNumber;
|
||||
for (int i = 0; i < document()->lineCount(); i++)
|
||||
{
|
||||
int nextTextEditPosition = textEditPosition - document()->findBlockByLineNumber(i).length();
|
||||
int nextTextEditPosition = textEditPosition - m_lineLengths[i];
|
||||
if (nextTextEditPosition >= 0)
|
||||
{
|
||||
textEditPosition = nextTextEditPosition;
|
||||
@@ -805,14 +805,7 @@ int QtCodeArea::startTextEditPosition() const
|
||||
|
||||
int QtCodeArea::endTextEditPosition() const
|
||||
{
|
||||
int position = 0;
|
||||
|
||||
for (int i = 0; i < document()->blockCount(); i++)
|
||||
{
|
||||
position += document()->findBlockByLineNumber(i).length();
|
||||
}
|
||||
|
||||
return position - 1;
|
||||
return m_endTextEditPosition;
|
||||
}
|
||||
|
||||
std::set<int> QtCodeArea::getActiveLineNumbers() const
|
||||
@@ -869,14 +862,14 @@ std::vector<QRect> QtCodeArea::getCursorRectsForAnnotation(const Annotation& ann
|
||||
{
|
||||
// Avoid that annotations at line end span down to first column of the next line.
|
||||
if (annotation.startLine != annotation.endLine ||
|
||||
document()->findBlockByLineNumber(line - m_startLineNumber).length() != annotation.endCol)
|
||||
m_lineLengths[line - m_startLineNumber] != annotation.endCol)
|
||||
{
|
||||
cursor.setPosition(annotation.end);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cursor.setPosition(toTextEditPosition(line, document()->findBlockByLineNumber(line - m_startLineNumber).length() - 1));
|
||||
cursor.setPosition(toTextEditPosition(line, m_lineLengths[line - m_startLineNumber] - 1));
|
||||
}
|
||||
|
||||
rectEnd = cursorRect(cursor);
|
||||
@@ -965,3 +958,16 @@ void QtCodeArea::createActions()
|
||||
m_setIDECursorPositionAction->setToolTip(tr("Set the IDE Cursor to this code position"));
|
||||
connect(m_setIDECursorPositionAction, SIGNAL(triggered()), this, SLOT(setIDECursorPosition()));
|
||||
}
|
||||
|
||||
void QtCodeArea::createLineLengthCache()
|
||||
{
|
||||
m_endTextEditPosition = -1;
|
||||
|
||||
m_lineLengths.clear();
|
||||
|
||||
for (QTextBlock it = document()->begin(); it != document()->end(); it = it.next())
|
||||
{
|
||||
m_lineLengths.push_back(it.length());
|
||||
m_endTextEditPosition += it.length();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,6 +162,8 @@ private:
|
||||
|
||||
void createActions();
|
||||
|
||||
void createLineLengthCache();
|
||||
|
||||
static std::vector<AnnotationColor> s_annotationColors;
|
||||
|
||||
QtCodeFile* m_fileWidget;
|
||||
@@ -189,6 +191,9 @@ private:
|
||||
bool m_isActiveFile;
|
||||
bool m_lineNumbersHidden;
|
||||
bool m_wasAnnotated;
|
||||
|
||||
std::vector<int> m_lineLengths;
|
||||
int m_endTextEditPosition;
|
||||
};
|
||||
|
||||
#endif // QT_CODE_AREA_H
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "qt/element/QtSearchBar.h"
|
||||
|
||||
#include <QCompleter>
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
|
||||
@@ -89,11 +88,7 @@ void QtSearchBar::setAutocompletionList(const std::vector<SearchMatch>& autocomp
|
||||
|
||||
QAbstractItemView* QtSearchBar::getCompleterPopup()
|
||||
{
|
||||
if (m_searchBox->completer())
|
||||
{
|
||||
return m_searchBox->completer()->popup();
|
||||
}
|
||||
return nullptr;
|
||||
return m_searchBox->getCompleter()->popup();
|
||||
}
|
||||
|
||||
void QtSearchBar::refreshStyle()
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
#include "component/view/GraphViewStyle.h"
|
||||
#include "qt/element/QtAutocompletionList.h"
|
||||
#include "settings/ColorScheme.h"
|
||||
|
||||
QtSearchElement::QtSearchElement(const QString& text, QWidget* parent)
|
||||
@@ -69,8 +68,8 @@ QtSmartSearchBox::QtSmartSearchBox(QWidget* parent)
|
||||
connect(this, SIGNAL(textEdited(const QString&)), this, SLOT(onTextEdited(const QString&)));
|
||||
connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(onTextChanged(const QString&)));
|
||||
|
||||
QCompleter* completer = new QtAutocompletionList(this);
|
||||
setCompleter(completer);
|
||||
m_completer = new QtAutocompletionList(this);
|
||||
m_completer->setWidget(this);
|
||||
|
||||
updatePlaceholder();
|
||||
}
|
||||
@@ -79,13 +78,18 @@ QtSmartSearchBox::~QtSmartSearchBox()
|
||||
{
|
||||
}
|
||||
|
||||
QCompleter* QtSmartSearchBox::getCompleter() const
|
||||
{
|
||||
return m_completer;
|
||||
}
|
||||
|
||||
void QtSmartSearchBox::setAutocompletionList(const std::vector<SearchMatch>& autocompletionList)
|
||||
{
|
||||
// Save the cursor position, because after activating the completer the cursor gets set to the end position.
|
||||
int cursor = cursorPosition();
|
||||
|
||||
QtAutocompletionList* completer = dynamic_cast<QtAutocompletionList*>(this->completer());
|
||||
completer->completeAt(QPoint(textMargins().left() + 3, height() + 3), autocompletionList);
|
||||
QtAutocompletionList* completer = m_completer;
|
||||
completer->completeAt(QPoint(textMargins().left() + 3, height() + 5), autocompletionList);
|
||||
|
||||
setCursorPosition(cursor);
|
||||
|
||||
@@ -138,7 +142,7 @@ bool QtSmartSearchBox::event(QEvent *event)
|
||||
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
|
||||
if (keyEvent->key() == Qt::Key_Tab)
|
||||
{
|
||||
if (completer()->popup()->isVisible())
|
||||
if (m_completer->popup()->isVisible())
|
||||
{
|
||||
addMatchAndUpdate(m_highlightedMatch);
|
||||
}
|
||||
@@ -170,7 +174,7 @@ void QtSmartSearchBox::keyPressEvent(QKeyEvent* event)
|
||||
fullTextSearch();
|
||||
return;
|
||||
}
|
||||
else if (!completer()->popup()->isVisible())
|
||||
else if (!m_completer->popup()->isVisible())
|
||||
{
|
||||
search();
|
||||
}
|
||||
@@ -244,7 +248,7 @@ void QtSmartSearchBox::keyPressEvent(QKeyEvent* event)
|
||||
}
|
||||
else if (cursorPosition() == text().size() && !event->isAutoRepeat())
|
||||
{
|
||||
if (completer()->popup()->isVisible())
|
||||
if (m_completer->popup()->isVisible())
|
||||
{
|
||||
addMatchAndUpdate(m_highlightedMatch);
|
||||
}
|
||||
@@ -445,6 +449,10 @@ void QtSmartSearchBox::onTextEdited(const QString& text)
|
||||
{
|
||||
requestAutoCompletions();
|
||||
}
|
||||
else
|
||||
{
|
||||
hideAutoCompletions();
|
||||
}
|
||||
}
|
||||
|
||||
void QtSmartSearchBox::onTextChanged(const QString& text)
|
||||
@@ -549,9 +557,9 @@ void QtSmartSearchBox::addMatch(const SearchMatch& match)
|
||||
|
||||
const SearchMatch* matchPtr = &match;
|
||||
|
||||
if (completer()->popup()->isVisible())
|
||||
if (m_completer->popup()->isVisible())
|
||||
{
|
||||
const SearchMatch* mPtr = dynamic_cast<QtAutocompletionList*>(completer())->getSearchMatchAt(0);
|
||||
const SearchMatch* mPtr = m_completer->getSearchMatchAt(0);
|
||||
if (mPtr && utility::equalsCaseInsensitive(match.getFullName(), mPtr->getFullName()))
|
||||
{
|
||||
matchPtr = mPtr;
|
||||
@@ -862,7 +870,7 @@ void QtSmartSearchBox::requestAutoCompletions() const
|
||||
|
||||
void QtSmartSearchBox::hideAutoCompletions()
|
||||
{
|
||||
completer()->popup()->hide();
|
||||
m_completer->popup()->hide();
|
||||
}
|
||||
|
||||
std::deque<SearchMatch> QtSmartSearchBox::getMatchesForInput(const std::string& text) const
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <QPushButton>
|
||||
|
||||
#include "data/search/SearchMatch.h"
|
||||
#include "qt/element/QtAutocompletionList.h"
|
||||
|
||||
class QtSearchElement
|
||||
: public QPushButton
|
||||
@@ -38,6 +39,8 @@ public:
|
||||
QtSmartSearchBox(QWidget* parent);
|
||||
virtual ~QtSmartSearchBox();
|
||||
|
||||
QCompleter* getCompleter() const;
|
||||
|
||||
void setAutocompletionList(const std::vector<SearchMatch>& autocompletionList);
|
||||
void setMatches(const std::vector<SearchMatch>& matches);
|
||||
void setFocus();
|
||||
@@ -109,6 +112,7 @@ private:
|
||||
int m_mouseX;
|
||||
|
||||
QWidget* m_highlightRect;
|
||||
QtAutocompletionList* m_completer;
|
||||
};
|
||||
|
||||
#endif // QT_SMART_SEARCH_BOX_H
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
#include "qt/utility/QtContextMenu.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QContextMenuEvent>
|
||||
|
||||
#include "utility/messaging/type/MessageRedo.h"
|
||||
#include "utility/messaging/type/MessageUndo.h"
|
||||
|
||||
std::shared_ptr<QtContextMenu> QtContextMenu::s_instance;
|
||||
|
||||
QtContextMenu* QtContextMenu::getInstance()
|
||||
{
|
||||
if (!s_instance)
|
||||
{
|
||||
s_instance = std::make_shared<QtContextMenu>();
|
||||
}
|
||||
|
||||
return s_instance.get();
|
||||
}
|
||||
|
||||
QtContextMenu::QtContextMenu()
|
||||
{
|
||||
m_undoAction = new QAction(tr("Back"), this);
|
||||
m_undoAction->setStatusTip(tr("Go back to last active symbol"));
|
||||
m_undoAction->setToolTip(tr("Go back to last active symbol"));
|
||||
connect(m_undoAction, SIGNAL(triggered()), this, SLOT(undoActionTriggered()));
|
||||
|
||||
m_redoAction = new QAction(tr("Forward"), this);
|
||||
m_redoAction->setStatusTip(tr("Go forward to next active symbol"));
|
||||
m_redoAction->setToolTip(tr("Go forward to next active symbol"));
|
||||
connect(m_redoAction, SIGNAL(triggered()), this, SLOT(redoActionTriggered()));
|
||||
}
|
||||
|
||||
void QtContextMenu::showDefault(QContextMenuEvent* event, QWidget* origin)
|
||||
{
|
||||
showExtended(event, origin, std::vector<QAction*>());
|
||||
}
|
||||
|
||||
void QtContextMenu::showExtended(QContextMenuEvent* event, QWidget* origin, const std::vector<QAction*>& actions)
|
||||
{
|
||||
QMenu menu(origin);
|
||||
|
||||
menu.addAction(m_undoAction);
|
||||
menu.addAction(m_redoAction);
|
||||
|
||||
if (actions.size())
|
||||
{
|
||||
menu.addSeparator();
|
||||
|
||||
for (QAction* action : actions)
|
||||
{
|
||||
menu.addAction(action);
|
||||
}
|
||||
}
|
||||
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
|
||||
void QtContextMenu::undoActionTriggered()
|
||||
{
|
||||
MessageUndo().dispatch();
|
||||
}
|
||||
|
||||
void QtContextMenu::redoActionTriggered()
|
||||
{
|
||||
MessageRedo().dispatch();
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef QT_CONTEXT_MENU_H
|
||||
#define QT_CONTEXT_MENU_H
|
||||
|
||||
#include <memory>
|
||||
#include <QAction>
|
||||
#include <QObject>
|
||||
|
||||
class QtContextMenu
|
||||
: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static QtContextMenu* getInstance();
|
||||
|
||||
QtContextMenu();
|
||||
|
||||
void showDefault(QContextMenuEvent* event, QWidget* origin);
|
||||
void showExtended(QContextMenuEvent* event, QWidget* origin, const std::vector<QAction*>& actions);
|
||||
|
||||
private slots:
|
||||
void undoActionTriggered();
|
||||
void redoActionTriggered();
|
||||
|
||||
private:
|
||||
static std::shared_ptr<QtContextMenu> s_instance;
|
||||
|
||||
QAction* m_undoAction;
|
||||
QAction* m_redoAction;
|
||||
};
|
||||
|
||||
#endif // QT_CONTEXT_MENU_H
|
||||
@@ -157,6 +157,8 @@ void QtCodeView::doShowCodeSnippets(const std::vector<CodeSnippetParams>& snippe
|
||||
m_widget->updateFiles();
|
||||
|
||||
setStyleSheet(); // so property "isLast" of QtCodeSnippet is computed correctly
|
||||
|
||||
hideOverlay();
|
||||
}
|
||||
|
||||
void QtCodeView::doAddCodeSnippets(const std::vector<CodeSnippetParams>& snippets, bool insert)
|
||||
@@ -170,12 +172,16 @@ void QtCodeView::doAddCodeSnippets(const std::vector<CodeSnippetParams>& snippet
|
||||
|
||||
setStyleSheet(); // so property "isLast" of QtCodeSnippet is computed correctly
|
||||
|
||||
hideOverlay();
|
||||
|
||||
m_widget->scrollToActiveFileIfRequested();
|
||||
}
|
||||
|
||||
void QtCodeView::doShowCodeFile(const CodeSnippetParams& params)
|
||||
{
|
||||
m_widget->addCodeSnippet(params);
|
||||
|
||||
hideOverlay();
|
||||
}
|
||||
|
||||
void QtCodeView::doSetFileState(const FilePath filePath, FileState state)
|
||||
@@ -192,6 +198,8 @@ void QtCodeView::doSetFileState(const FilePath filePath, FileState state)
|
||||
m_widget->setFileMaximized(filePath);
|
||||
break;
|
||||
}
|
||||
|
||||
hideOverlay();
|
||||
}
|
||||
|
||||
void QtCodeView::doShowFirstActiveSnippet(const std::vector<Id>& activeTokenIds, bool scrollTo)
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "qt/utility/utilityQt.h"
|
||||
|
||||
#include "qt/graphics/QtGraphicsView.h"
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
#include "qt/view/graphElements/nodeComponents/QtGraphNodeComponentClickable.h"
|
||||
#include "qt/view/graphElements/nodeComponents/QtGraphNodeComponentMoveable.h"
|
||||
#include "qt/view/graphElements/QtGraphEdge.h"
|
||||
@@ -27,12 +26,14 @@
|
||||
#include "qt/view/graphElements/QtGraphNodeBundle.h"
|
||||
#include "qt/view/graphElements/QtGraphNodeData.h"
|
||||
#include "qt/view/graphElements/QtGraphNodeExpandToggle.h"
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
#include "settings/ColorScheme.h"
|
||||
|
||||
QtGraphView::QtGraphView(ViewLayout* viewLayout)
|
||||
: GraphView(viewLayout)
|
||||
, m_rebuildGraphFunctor(
|
||||
std::bind(&QtGraphView::doRebuildGraph, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3))
|
||||
std::bind(&QtGraphView::doRebuildGraph, this,
|
||||
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4))
|
||||
, m_clearFunctor(std::bind(&QtGraphView::doClear, this))
|
||||
, m_resizeFunctor(std::bind(&QtGraphView::doResize, this))
|
||||
, m_refreshFunctor(std::bind(&QtGraphView::doRefreshView, this))
|
||||
@@ -82,9 +83,10 @@ void QtGraphView::refreshView()
|
||||
void QtGraphView::rebuildGraph(
|
||||
std::shared_ptr<Graph> graph,
|
||||
const std::vector<std::shared_ptr<DummyNode>>& nodes,
|
||||
const std::vector<std::shared_ptr<DummyEdge>>& edges
|
||||
const std::vector<std::shared_ptr<DummyEdge>>& edges,
|
||||
bool animated
|
||||
){
|
||||
m_rebuildGraphFunctor(graph, nodes, edges);
|
||||
m_rebuildGraphFunctor(graph, nodes, edges, animated);
|
||||
}
|
||||
|
||||
void QtGraphView::clear()
|
||||
@@ -197,7 +199,8 @@ QtGraphicsView* QtGraphView::getView() const
|
||||
void QtGraphView::doRebuildGraph(
|
||||
std::shared_ptr<Graph> graph,
|
||||
const std::vector<std::shared_ptr<DummyNode>>& nodes,
|
||||
const std::vector<std::shared_ptr<DummyEdge>>& edges
|
||||
const std::vector<std::shared_ptr<DummyEdge>>& edges,
|
||||
bool animated
|
||||
){
|
||||
if (m_transition && m_transition->currentTime() < m_transition->totalDuration())
|
||||
{
|
||||
@@ -248,7 +251,16 @@ void QtGraphView::doRebuildGraph(
|
||||
m_graph = graph;
|
||||
}
|
||||
|
||||
createTransition();
|
||||
hideOverlay();
|
||||
|
||||
if (animated)
|
||||
{
|
||||
createTransition();
|
||||
}
|
||||
else
|
||||
{
|
||||
switchToNewGraphData();
|
||||
}
|
||||
}
|
||||
|
||||
void QtGraphView::doClear()
|
||||
@@ -596,7 +608,7 @@ void QtGraphView::doFocusIn(const std::vector<Id>& tokenIds)
|
||||
for (const Id& tokenId : tokenIds)
|
||||
{
|
||||
std::shared_ptr<QtGraphNode> node = findNodeRecursive(m_oldNodes, tokenId);
|
||||
if (node && node->isDataNode())
|
||||
if (node)
|
||||
{
|
||||
node->focusIn();
|
||||
continue;
|
||||
|
||||
@@ -34,7 +34,8 @@ public:
|
||||
virtual void rebuildGraph(
|
||||
std::shared_ptr<Graph> graph,
|
||||
const std::vector<std::shared_ptr<DummyNode>>& nodes,
|
||||
const std::vector<std::shared_ptr<DummyEdge>>& edges);
|
||||
const std::vector<std::shared_ptr<DummyEdge>>& edges,
|
||||
bool animated);
|
||||
virtual void clear();
|
||||
|
||||
virtual void focusTokenIds(const std::vector<Id>& focusedTokenIds);
|
||||
@@ -57,7 +58,8 @@ private:
|
||||
void doRebuildGraph(
|
||||
std::shared_ptr<Graph> graph,
|
||||
const std::vector<std::shared_ptr<DummyNode>>& nodes,
|
||||
const std::vector<std::shared_ptr<DummyEdge>>& edges);
|
||||
const std::vector<std::shared_ptr<DummyEdge>>& edges,
|
||||
bool animated);
|
||||
void doClear();
|
||||
void doResize();
|
||||
void doRefreshView();
|
||||
@@ -86,7 +88,8 @@ private:
|
||||
QtThreadedFunctor<
|
||||
std::shared_ptr<Graph>,
|
||||
const std::vector<std::shared_ptr<DummyNode>>&,
|
||||
const std::vector<std::shared_ptr<DummyEdge>>&
|
||||
const std::vector<std::shared_ptr<DummyEdge>>&,
|
||||
bool
|
||||
> m_rebuildGraphFunctor;
|
||||
QtThreadedFunctor<void> m_clearFunctor;
|
||||
QtThreadedFunctor<void> m_resizeFunctor;
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
#include "qt/view/QtViewOverlay.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <QEvent>
|
||||
#include <QPainter>
|
||||
#include <QPaintEvent>
|
||||
#include <QTimer>
|
||||
|
||||
ResizeFilter::ResizeFilter(QWidget* widget)
|
||||
: m_widget(widget)
|
||||
{
|
||||
}
|
||||
|
||||
bool ResizeFilter::eventFilter(QObject* obj, QEvent* event)
|
||||
{
|
||||
if (event->type() == QEvent::Resize)
|
||||
{
|
||||
QWidget* parent = dynamic_cast<QWidget*>(obj);
|
||||
m_widget->setGeometry(0, 0, parent->width(), parent->height());
|
||||
}
|
||||
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
QtOverlay::QtOverlay(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, m_count(rand() % 1000000)
|
||||
, m_size(40)
|
||||
{
|
||||
m_timer = new QTimer(this);
|
||||
QObject::connect(m_timer, SIGNAL(timeout()), this, SLOT(animate()));
|
||||
}
|
||||
|
||||
void QtOverlay::start()
|
||||
{
|
||||
m_timePoint = TimePoint::now();
|
||||
m_timer->start(FRAME_DELAY_MS);
|
||||
show();
|
||||
}
|
||||
|
||||
void QtOverlay::stop()
|
||||
{
|
||||
m_timer->stop();
|
||||
hide();
|
||||
}
|
||||
|
||||
void QtOverlay::animate()
|
||||
{
|
||||
TimePoint t = TimePoint::now();
|
||||
size_t dt = t.deltaMS(m_timePoint);
|
||||
|
||||
if (dt < 5)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_timePoint = t;
|
||||
m_count += dt;
|
||||
|
||||
QPoint center = geometry().center();
|
||||
update(QRect(center.x() - m_size / 2, center.y() - m_size / 2, m_size, m_size));
|
||||
}
|
||||
|
||||
void QtOverlay::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPainter painter(this);
|
||||
|
||||
painter.fillRect(geometry(), "#AAFFFFFF");
|
||||
|
||||
QPoint center = geometry().center();
|
||||
|
||||
size_t x = m_size / 2;
|
||||
size_t y = m_size / 2;
|
||||
size_t s = (m_count / 7) % 200;
|
||||
|
||||
if (s < 100)
|
||||
{
|
||||
x = std::cos(3.1415f * s / 100) * x;
|
||||
}
|
||||
else
|
||||
{
|
||||
y = std::cos(3.1415f * (s - 100) / 100) * y;
|
||||
}
|
||||
|
||||
painter.translate(center.x(), center.y());
|
||||
// painter.rotate(m_count / 8);
|
||||
|
||||
if (s > 50 && s < 150)
|
||||
{
|
||||
painter.setBrush(QBrush("#882E3C86"));
|
||||
}
|
||||
else
|
||||
{
|
||||
painter.setBrush(QBrush("#88007AC2"));
|
||||
}
|
||||
|
||||
painter.setPen(QPen(Qt::transparent));
|
||||
|
||||
painter.drawEllipse(-x, -y, 2 * x, 2 * y);
|
||||
}
|
||||
|
||||
|
||||
QtViewOverlay::QtViewOverlay(QWidget* parent)
|
||||
: m_parent(parent)
|
||||
, m_showFunctor(std::bind(&QtViewOverlay::doShowOverlay, this))
|
||||
, m_hideFunctor(std::bind(&QtViewOverlay::doHideOverlay, this))
|
||||
{
|
||||
m_overlay = new QtOverlay(m_parent);
|
||||
m_overlay->hide();
|
||||
|
||||
m_parent->installEventFilter(new ResizeFilter(m_overlay));
|
||||
|
||||
m_delayTimer = new QTimer(m_overlay);
|
||||
m_delayTimer->setSingleShot(true);
|
||||
QObject::connect(m_delayTimer, SIGNAL(timeout()), m_overlay, SLOT(start()));
|
||||
}
|
||||
|
||||
void QtViewOverlay::showOverlay()
|
||||
{
|
||||
m_showFunctor();
|
||||
}
|
||||
|
||||
void QtViewOverlay::hideOverlay()
|
||||
{
|
||||
m_hideFunctor();
|
||||
}
|
||||
|
||||
void QtViewOverlay::doShowOverlay()
|
||||
{
|
||||
m_delayTimer->start(500);
|
||||
}
|
||||
|
||||
void QtViewOverlay::doHideOverlay()
|
||||
{
|
||||
m_delayTimer->stop();
|
||||
m_overlay->stop();
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
#ifndef QT_VIEW_OVERLAY
|
||||
#define QT_VIEW_OVERLAY
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "qt/utility/QtThreadedFunctor.h"
|
||||
#include "utility/TimePoint.h"
|
||||
|
||||
class QTimer;
|
||||
|
||||
class ResizeFilter
|
||||
: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
signals:
|
||||
void triggered();
|
||||
|
||||
public:
|
||||
ResizeFilter(QWidget* widget);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject* obj, QEvent* event);
|
||||
|
||||
private:
|
||||
QWidget* m_widget;
|
||||
};
|
||||
|
||||
|
||||
class QtOverlay
|
||||
: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtOverlay(QWidget* parent = nullptr);
|
||||
|
||||
static const size_t FRAME_DELAY_MS = 25;
|
||||
|
||||
public slots:
|
||||
void start();
|
||||
void stop();
|
||||
void animate();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
private:
|
||||
QTimer* m_timer;
|
||||
|
||||
size_t m_count;
|
||||
size_t m_size;
|
||||
|
||||
TimePoint m_timePoint;
|
||||
};
|
||||
|
||||
|
||||
class QtViewOverlay
|
||||
{
|
||||
public:
|
||||
QtViewOverlay(QWidget* parent = 0);
|
||||
|
||||
void showOverlay();
|
||||
void hideOverlay();
|
||||
|
||||
private:
|
||||
void doShowOverlay();
|
||||
void doHideOverlay();
|
||||
|
||||
QWidget* m_parent;
|
||||
QtOverlay* m_overlay;
|
||||
|
||||
QTimer* m_delayTimer;
|
||||
|
||||
QtThreadedFunctor<void> m_showFunctor;
|
||||
QtThreadedFunctor<void> m_hideFunctor;
|
||||
};
|
||||
|
||||
#endif // QT_VIEW_OVERLAY
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
|
||||
#include "component/view/View.h"
|
||||
#include "qt/view/QtViewOverlay.h"
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
QWidget* QtViewWidgetWrapper::getWidgetOfView(const View* view)
|
||||
@@ -24,6 +25,7 @@ QWidget* QtViewWidgetWrapper::getWidgetOfView(const View* view)
|
||||
|
||||
QtViewWidgetWrapper::QtViewWidgetWrapper(QWidget* widget)
|
||||
: m_widget(widget)
|
||||
, m_overlay(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -31,6 +33,27 @@ QtViewWidgetWrapper::~QtViewWidgetWrapper()
|
||||
{
|
||||
}
|
||||
|
||||
void QtViewWidgetWrapper::createOverlay()
|
||||
{
|
||||
m_overlay = new QtViewOverlay(m_widget);
|
||||
}
|
||||
|
||||
void QtViewWidgetWrapper::showOverlay()
|
||||
{
|
||||
if (m_overlay)
|
||||
{
|
||||
m_overlay->showOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
void QtViewWidgetWrapper::hideOverlay()
|
||||
{
|
||||
if (m_overlay)
|
||||
{
|
||||
m_overlay->hideOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
QWidget* QtViewWidgetWrapper::getWidget()
|
||||
{
|
||||
return m_widget;
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
#include "component/view/ViewWidgetWrapper.h"
|
||||
|
||||
class View;
|
||||
class QtViewOverlay;
|
||||
|
||||
class QtViewWidgetWrapper: public ViewWidgetWrapper
|
||||
class QtViewWidgetWrapper
|
||||
: public ViewWidgetWrapper
|
||||
{
|
||||
public:
|
||||
static QWidget* getWidgetOfView(const View* view);
|
||||
@@ -15,10 +17,16 @@ public:
|
||||
QtViewWidgetWrapper(QWidget* widget);
|
||||
virtual ~QtViewWidgetWrapper();
|
||||
|
||||
virtual void createOverlay() override;
|
||||
virtual void showOverlay() override;
|
||||
virtual void hideOverlay() override;
|
||||
|
||||
QWidget* getWidget();
|
||||
|
||||
private:
|
||||
QWidget* m_widget;
|
||||
|
||||
QtViewOverlay* m_overlay;
|
||||
};
|
||||
|
||||
#endif // QT_VIEW_WIDGET_WRAPPER_H
|
||||
|
||||
@@ -33,10 +33,9 @@ void QtAbout::setupAbout()
|
||||
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath() + "about/about.css").c_str());
|
||||
|
||||
QVBoxLayout* windowLayout = new QVBoxLayout();
|
||||
windowLayout->setContentsMargins(30, 30, 30, 20);
|
||||
m_window->setLayout(windowLayout);
|
||||
|
||||
windowLayout->addStretch();
|
||||
windowLayout->setContentsMargins(10, 10, 10, 0);
|
||||
windowLayout->setSpacing(1);
|
||||
m_content->setLayout(windowLayout);
|
||||
|
||||
{
|
||||
QHBoxLayout* row = new QHBoxLayout();
|
||||
@@ -56,6 +55,16 @@ void QtAbout::setupAbout()
|
||||
QVBoxLayout* column = new QVBoxLayout();
|
||||
row->addLayout(column);
|
||||
|
||||
QtDeviceScaledPixmap closePixmap((ResourcePaths::getGuiPath() + "about/icon_close.png").c_str());
|
||||
closePixmap.scaleToHeight(20);
|
||||
QPushButton* closeButton = new QPushButton(this);
|
||||
closeButton->setIcon(QIcon(closePixmap.pixmap()));
|
||||
closeButton->setObjectName("closeButton");
|
||||
closeButton->show();
|
||||
connect(closeButton, SIGNAL(clicked()), this, SLOT(handleCloseButtonPress()));
|
||||
|
||||
column->addWidget(closeButton, 0, Qt::AlignTop | Qt::AlignRight);
|
||||
|
||||
column->addStretch();
|
||||
|
||||
QLabel* developerTitle = new QLabel("<b>Developed by:</b>", this);
|
||||
@@ -104,9 +113,9 @@ void QtAbout::setupAbout()
|
||||
|
||||
QLabel* companyLabel = new QLabel(
|
||||
"<b>Coati Software OG</b><br />"
|
||||
"<b>Schlossallee 7/1</b><br />"
|
||||
"<b>5412 Puch bei Hallein</b><br />"
|
||||
"<b>Austria</b><br />"
|
||||
"Schlossallee 7/1<br />"
|
||||
"5412 Puch bei Hallein<br />"
|
||||
"Austria<br />"
|
||||
"<b>support@coati.io</b><br />"
|
||||
"<b><a href=\"https://coati.io\" style=\"color: white;\">coati.io</a></b>",
|
||||
this);
|
||||
@@ -139,19 +148,6 @@ void QtAbout::setupAbout()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
windowLayout->addStretch();
|
||||
|
||||
|
||||
QtDeviceScaledPixmap closePixmap((ResourcePaths::getGuiPath() + "about/icon_close.png").c_str());
|
||||
closePixmap.scaleToHeight(20);
|
||||
QPushButton* closeButton = new QPushButton(this);
|
||||
closeButton->setIcon(QIcon(closePixmap.pixmap()));
|
||||
closeButton->setObjectName("closeButton");
|
||||
closeButton->move(455, 25);
|
||||
closeButton->show();
|
||||
|
||||
connect(closeButton, SIGNAL(clicked()), this, SLOT(handleCloseButtonPress()));
|
||||
}
|
||||
|
||||
void QtAbout::handleCloseButtonPress()
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "component/view/View.h"
|
||||
#include "component/view/CompositeView.h"
|
||||
#include "qt/utility/QtContextMenu.h"
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzard.h"
|
||||
@@ -30,13 +31,13 @@
|
||||
#include "utility/messaging/type/MessageRedo.h"
|
||||
#include "utility/messaging/type/MessageRefresh.h"
|
||||
#include "utility/messaging/type/MessageResetZoom.h"
|
||||
#include "utility/messaging/type/MessageSaveProject.h"
|
||||
#include "utility/messaging/type/MessageSearch.h"
|
||||
#include "utility/messaging/type/MessageSwitchColorScheme.h"
|
||||
#include "utility/messaging/type/MessageUndo.h"
|
||||
#include "utility/messaging/type/MessageWindowFocus.h"
|
||||
#include "utility/messaging/type/MessageZoom.h"
|
||||
#include "utility/ResourcePaths.h"
|
||||
#include "utility/tracing.h"
|
||||
#include "utility/UserPaths.h"
|
||||
#include "version.h"
|
||||
#include "isTrial.h"
|
||||
@@ -139,8 +140,6 @@ QtMainWindow::QtMainWindow()
|
||||
setWindowIcon(QIcon((ResourcePaths::getGuiPath() + "icon/logo_1024_1024.png").c_str()));
|
||||
setWindowFlags(Qt::Widget);
|
||||
|
||||
// QApplication::setOverrideCursor(Qt::ArrowCursor);
|
||||
|
||||
QApplication* app = dynamic_cast<QApplication*>(QCoreApplication::instance());
|
||||
app->installEventFilter(new MouseReleaseFilter(this));
|
||||
app->installEventFilter(new MouseWheelFilter(this));
|
||||
@@ -154,8 +153,6 @@ QtMainWindow::QtMainWindow()
|
||||
setupViewMenu();
|
||||
setupHelpMenu();
|
||||
|
||||
setupShortcuts();
|
||||
|
||||
// Need to call loadLayout here for right DockWidget size on Linux
|
||||
// Seconde call is in Application.cpp
|
||||
loadLayout();
|
||||
@@ -300,12 +297,27 @@ bool QtMainWindow::event(QEvent* event)
|
||||
|
||||
void QtMainWindow::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Backspace)
|
||||
switch (event->key())
|
||||
{
|
||||
MessageUndo().dispatch();
|
||||
case Qt::Key_Backspace:
|
||||
MessageUndo().dispatch();
|
||||
break;
|
||||
|
||||
case Qt::Key_Escape:
|
||||
MessageInterruptTasks().dispatch();
|
||||
break;
|
||||
|
||||
case Qt::Key_Space:
|
||||
PRINT_TRACES();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void QtMainWindow::contextMenuEvent(QContextMenuEvent* event)
|
||||
{
|
||||
QtContextMenu::getInstance()->showDefault(event, this);
|
||||
}
|
||||
|
||||
void QtMainWindow::activateWindow()
|
||||
{
|
||||
this->setEnabled(true);
|
||||
@@ -437,22 +449,6 @@ void QtMainWindow::forceRefresh()
|
||||
MessageRefresh().refreshAll().dispatch();
|
||||
}
|
||||
|
||||
void QtMainWindow::saveProject()
|
||||
{
|
||||
MessageSaveProject("").dispatch();
|
||||
}
|
||||
|
||||
void QtMainWindow::saveAsProject()
|
||||
{
|
||||
QString filename = "";
|
||||
filename = QFileDialog::getSaveFileName(this, "Save File as", "", "Coati Project Files (*.coatiproject)");
|
||||
|
||||
if(!filename.isEmpty())
|
||||
{
|
||||
MessageSaveProject(filename.toStdString()).dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
void QtMainWindow::undo()
|
||||
{
|
||||
MessageUndo().dispatch();
|
||||
@@ -502,11 +498,6 @@ void QtMainWindow::toggleView(View* view, bool fromMenu)
|
||||
}
|
||||
}
|
||||
|
||||
void QtMainWindow::handleEscapeShortcut()
|
||||
{
|
||||
MessageInterruptTasks().dispatch();
|
||||
}
|
||||
|
||||
void QtMainWindow::setupProjectMenu()
|
||||
{
|
||||
QMenu *menu = new QMenu(tr("&Project"), this);
|
||||
@@ -540,11 +531,6 @@ void QtMainWindow::setupProjectMenu()
|
||||
menu->addAction(tr("&Edit Project..."), this, SLOT(editProject()));
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
menu->addAction(tr("&Save Project"), this, SLOT(saveProject()), QKeySequence::Save);
|
||||
menu->addAction(tr("Save Project as..."), this, SLOT(saveAsProject()), QKeySequence::SaveAs);
|
||||
|
||||
menu->addSeparator();
|
||||
}
|
||||
|
||||
menu->addAction(tr("E&xit"), QCoreApplication::instance(), SLOT(quit()), QKeySequence::Quit);
|
||||
@@ -658,12 +644,6 @@ void QtMainWindow::setupHelpMenu()
|
||||
}
|
||||
}
|
||||
|
||||
void QtMainWindow::setupShortcuts()
|
||||
{
|
||||
m_escapeShortcut = new QShortcut(QKeySequence(Qt::Key_Escape), this);
|
||||
connect(m_escapeShortcut, SIGNAL(activated()), SLOT(handleEscapeShortcut()));
|
||||
}
|
||||
|
||||
QtMainWindow::DockWidget* QtMainWindow::getDockWidgetForView(View* view)
|
||||
{
|
||||
for (DockWidget& dock : m_dockWidgets)
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QShortcut>
|
||||
|
||||
#include "qt/utility/QtThreadedFunctor.h"
|
||||
#include "qt/window/QtWindowStack.h"
|
||||
@@ -90,6 +89,7 @@ public:
|
||||
protected:
|
||||
bool event(QEvent* event);
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
void contextMenuEvent(QContextMenuEvent* event);
|
||||
|
||||
public slots:
|
||||
void activateWindow();
|
||||
@@ -118,9 +118,6 @@ public slots:
|
||||
void refresh();
|
||||
void forceRefresh();
|
||||
|
||||
void saveProject();
|
||||
void saveAsProject();
|
||||
|
||||
void undo();
|
||||
void redo();
|
||||
void zoomIn();
|
||||
@@ -130,8 +127,6 @@ public slots:
|
||||
|
||||
void toggleView(View* view, bool fromMenu);
|
||||
|
||||
void handleEscapeShortcut();
|
||||
|
||||
void updateRecentProjectMenu();
|
||||
|
||||
private slots:
|
||||
@@ -151,8 +146,6 @@ private:
|
||||
void setupViewMenu();
|
||||
void setupHelpMenu();
|
||||
|
||||
void setupShortcuts();
|
||||
|
||||
DockWidget* getDockWidgetForView(View* view);
|
||||
|
||||
void setShowDockWidgetTitleBars(bool showTitleBars);
|
||||
@@ -165,11 +158,10 @@ private:
|
||||
QAction* m_viewSeparator;
|
||||
QAction** m_recentProjectAction;
|
||||
QAction* m_showTitleBarsAction;
|
||||
|
||||
bool m_showDockWidgetTitleBars;
|
||||
|
||||
QtWindowStack m_windowStack;
|
||||
|
||||
QShortcut* m_escapeShortcut;
|
||||
};
|
||||
|
||||
#endif // QT_MAIN_WINDOW_H
|
||||
|
||||
@@ -126,77 +126,111 @@ void QtStartScreen::setupStartScreen()
|
||||
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath() + "startscreen/startscreen.css").c_str());
|
||||
addLogo();
|
||||
|
||||
if (isTrial())
|
||||
QHBoxLayout* layout = new QHBoxLayout();
|
||||
layout->setContentsMargins(15, 170, 15, 10);
|
||||
layout->setSpacing(1);
|
||||
m_content->setLayout(layout);
|
||||
|
||||
{
|
||||
QLabel* welcomeLabel = new QLabel(
|
||||
"Welcome to the <b>Coati trial</b>!<br /><br />"
|
||||
"Explore our preindexed projects to experience Coati's unique user interface.<br /><br />"
|
||||
"If you want to use Coati on your own source code please "
|
||||
"<a href=\"http://coati.io/buy-license\" style=\"color: #007AC2;\">purchase a license</a>, "
|
||||
"or ask us for a temporary test license by writing to <b>support@coati.io</b>.", this);
|
||||
welcomeLabel->setOpenExternalLinks(true);
|
||||
welcomeLabel->setGeometry(30, 303, 200, 500);
|
||||
welcomeLabel->setObjectName("welcomeLabel");
|
||||
welcomeLabel->show();
|
||||
welcomeLabel->setWordWrap(true);
|
||||
welcomeLabel->setAlignment(Qt::AlignTop);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_newProjectButton = new QPushButton("New Project", this);
|
||||
m_newProjectButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
m_newProjectButton->move(30, 505);
|
||||
m_newProjectButton->setObjectName("projectButton");
|
||||
m_newProjectButton->show();
|
||||
connect(m_newProjectButton, SIGNAL(clicked()), this, SLOT(handleNewProjectButton()));
|
||||
QVBoxLayout* col = new QVBoxLayout();
|
||||
layout->addLayout(col, 2);
|
||||
|
||||
m_openProjectButton = new QPushButton("Open Project", this);
|
||||
m_openProjectButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
m_openProjectButton->move(30, 540);
|
||||
m_openProjectButton->setObjectName("projectButton");
|
||||
m_openProjectButton->show();
|
||||
connect(m_openProjectButton, SIGNAL(clicked()), this, SLOT(handleOpenProjectButton()));
|
||||
if (isTrial())
|
||||
{
|
||||
col->addSpacing(50);
|
||||
|
||||
QLabel* versionLabel = new QLabel(("Version " + Version::getApplicationVersion().toDisplayString()).c_str(), this);
|
||||
versionLabel->setGeometry(30, 234, 300, 50);
|
||||
versionLabel->setObjectName("versionLabel");
|
||||
versionLabel->show();
|
||||
QLabel* welcomeLabel = new QLabel(
|
||||
"Welcome to the <b>Coati trial</b>!<br /><br />"
|
||||
"Explore our preindexed projects to experience Coati's unique user interface.<br /><br />"
|
||||
"If you want to use Coati on your own source code please "
|
||||
"<a href=\"http://coati.io/buy-license\" style=\"color: #007AC2;\">purchase a license</a>, "
|
||||
"or ask us for a temporary test license by writing to <b>support@coati.io</b>.", this);
|
||||
welcomeLabel->setOpenExternalLinks(true);
|
||||
welcomeLabel->setObjectName("welcomeLabel");
|
||||
welcomeLabel->setWordWrap(true);
|
||||
welcomeLabel->setAlignment(Qt::AlignTop);
|
||||
|
||||
QLabel* updateLabel = new QLabel(
|
||||
"<a href=\"https://coati.io/downloads\" style=\"color: #007AC2;\">check for new version</a>", this);
|
||||
updateLabel->setOpenExternalLinks(true);
|
||||
updateLabel->setGeometry(30, 255, 300, 50);
|
||||
updateLabel->setObjectName("updateLabel");
|
||||
updateLabel->show();
|
||||
col->addWidget(welcomeLabel, 0, Qt::AlignHCenter | Qt::AlignTop);
|
||||
col->addStretch();
|
||||
|
||||
layout->addStretch(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
QLabel* versionLabel = new QLabel(("Version " + Version::getApplicationVersion().toDisplayString()).c_str(), this);
|
||||
versionLabel->setObjectName("versionLabel");
|
||||
col->addWidget(versionLabel);
|
||||
|
||||
QLabel* updateLabel = new QLabel(
|
||||
"<a href=\"https://coati.io/downloads\" style=\"color: #007AC2;\">check for new version</a>", this);
|
||||
updateLabel->setOpenExternalLinks(true);
|
||||
updateLabel->setObjectName("updateLabel");
|
||||
col->addWidget(updateLabel);
|
||||
|
||||
col->addStretch();
|
||||
|
||||
QPushButton* newProjectButton = new QPushButton("New Project", this);
|
||||
newProjectButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
newProjectButton->setObjectName("projectButton");
|
||||
newProjectButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
connect(newProjectButton, SIGNAL(clicked()), this, SLOT(handleNewProjectButton()));
|
||||
col->addWidget(newProjectButton);
|
||||
|
||||
col->addSpacing(8);
|
||||
|
||||
QPushButton* openProjectButton = new QPushButton("Open Project", this);
|
||||
openProjectButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
openProjectButton->setObjectName("projectButton");
|
||||
openProjectButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
connect(openProjectButton, SIGNAL(clicked()), this, SLOT(handleOpenProjectButton()));
|
||||
col->addWidget(openProjectButton);
|
||||
|
||||
layout->addStretch(2);
|
||||
}
|
||||
}
|
||||
|
||||
QLabel* recentProjectsLabel = new QLabel("Recent Projects: ", this);
|
||||
if (isTrial())
|
||||
{
|
||||
recentProjectsLabel->setText("Projects:");
|
||||
}
|
||||
recentProjectsLabel->setGeometry(300, 234, 300, 50);
|
||||
recentProjectsLabel->setObjectName("recentLabel");
|
||||
recentProjectsLabel->show();
|
||||
QVBoxLayout* col = new QVBoxLayout();
|
||||
layout->addLayout(col, 1);
|
||||
|
||||
int position = 290;
|
||||
QIcon cpp_icon((ResourcePaths::getGuiPath() + "icon/project_256_256.png").c_str());
|
||||
for (int i = 0
|
||||
; i < ApplicationSettings::getInstance()->getMaxRecentProjectsCount()
|
||||
; i++)
|
||||
{
|
||||
QtRecentProjectButton* button = new QtRecentProjectButton(this);
|
||||
button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
button->setIcon(cpp_icon);
|
||||
button->setIconSize(QSize(25, 25));
|
||||
button->setObjectName("recentButtonMissing");
|
||||
button->setGeometry(292, position, button->fontMetrics().width(button->text()) + 45, 40);
|
||||
button->minimumSizeHint(); // force font loading
|
||||
button->show();
|
||||
position += 40;
|
||||
m_recentProjectsButtons.push_back(button);
|
||||
QLabel* recentProjectsLabel = new QLabel("Recent Projects: ", this);
|
||||
if (isTrial())
|
||||
{
|
||||
recentProjectsLabel->setText("Projects:");
|
||||
}
|
||||
recentProjectsLabel->setObjectName("recentLabel");
|
||||
col->addWidget(recentProjectsLabel);
|
||||
|
||||
col->addSpacing(20);
|
||||
|
||||
QIcon cpp_icon((ResourcePaths::getGuiPath() + "icon/project_256_256.png").c_str());
|
||||
for (int i = 0
|
||||
; i < ApplicationSettings::getInstance()->getMaxRecentProjectsCount()
|
||||
; i++)
|
||||
{
|
||||
QtRecentProjectButton* button = new QtRecentProjectButton(this);
|
||||
button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
button->setIcon(cpp_icon);
|
||||
button->setIconSize(QSize(25, 25));
|
||||
button->setMinimumSize(button->fontMetrics().width(button->text()) + 45, 40);
|
||||
button->setObjectName("recentButtonMissing");
|
||||
button->minimumSizeHint(); // force font loading
|
||||
m_recentProjectsButtons.push_back(button);
|
||||
col->addWidget(button);
|
||||
}
|
||||
|
||||
col->addStretch();
|
||||
}
|
||||
|
||||
layout->addStretch(1);
|
||||
|
||||
updateButtons();
|
||||
|
||||
QSize size = sizeHint();
|
||||
move(
|
||||
parentWidget()->pos().x() + parentWidget()->width() / 2 - size.width() / 2,
|
||||
parentWidget()->pos().y() + parentWidget()->height() / 2 - size.height() / 2
|
||||
);
|
||||
}
|
||||
|
||||
void QtStartScreen::handleNewProjectButton()
|
||||
|
||||
@@ -47,8 +47,6 @@ private slots:
|
||||
void updateButtons();
|
||||
|
||||
private:
|
||||
QPushButton* m_openProjectButton;
|
||||
QPushButton* m_newProjectButton;
|
||||
std::vector<QtRecentProjectButton*> m_recentProjectsButtons;
|
||||
};
|
||||
|
||||
|
||||
@@ -50,6 +50,24 @@ QtWindow::QtWindow(QWidget* parent)
|
||||
m_window->setGraphicsEffect(effect);
|
||||
}
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(m_window);
|
||||
layout->setSpacing(1);
|
||||
|
||||
m_content = new QWidget();
|
||||
layout->addWidget(m_content);
|
||||
|
||||
QHBoxLayout* gripLayout = new QHBoxLayout();
|
||||
QSizeGrip* sizeGrip = new QSizeGrip(m_window);
|
||||
sizeGrip->setStyleSheet(
|
||||
QString::fromStdString("QSizeGrip {"
|
||||
"max-height: 12px; max-width: 12px;"
|
||||
"border-image: url(" + ResourcePaths::getGuiPath() + "window/size_grip.png);"
|
||||
"}")
|
||||
);
|
||||
gripLayout->addWidget(new QWidget());
|
||||
gripLayout->addWidget(sizeGrip);
|
||||
layout->addLayout(gripLayout);
|
||||
|
||||
resize(sizeHint());
|
||||
|
||||
this->raise();
|
||||
@@ -67,7 +85,7 @@ void QtWindow::setup()
|
||||
{
|
||||
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath() + "window/window.css").c_str());
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
layout->setContentsMargins(25, 30, 25, 20);
|
||||
layout->setContentsMargins(25, 30, 25, 0);
|
||||
|
||||
m_title = new QLabel();
|
||||
m_title->setObjectName("title");
|
||||
@@ -120,7 +138,7 @@ void QtWindow::setup()
|
||||
layout->addLayout(buttons);
|
||||
}
|
||||
|
||||
m_window->setLayout(layout);
|
||||
m_content->setLayout(layout);
|
||||
|
||||
if (m_showAsPopup)
|
||||
{
|
||||
@@ -243,20 +261,32 @@ void QtWindow::hideWindow()
|
||||
|
||||
void QtWindow::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QSize size = event->size();
|
||||
|
||||
if (size.width() < 300)
|
||||
{
|
||||
size.setWidth(300);
|
||||
resize(size);
|
||||
return;
|
||||
}
|
||||
|
||||
if (size.height() < 200)
|
||||
{
|
||||
size.setHeight(200);
|
||||
resize(size);
|
||||
return;
|
||||
}
|
||||
|
||||
int displacement = 0;
|
||||
if (m_hasLogo)
|
||||
{
|
||||
displacement = 58;
|
||||
}
|
||||
|
||||
QSize windowSize = event->size() - QSize(10, 10 + displacement);
|
||||
QSize windowSize = size - QSize(10, 20 + displacement);
|
||||
|
||||
m_window->resize(windowSize);
|
||||
m_window->move(5, displacement + 10);
|
||||
|
||||
move(
|
||||
parentWidget()->pos().x() + parentWidget()->width() / 2 - event->size().width() / 2,
|
||||
parentWidget()->pos().y() + parentWidget()->height() / 2 - event->size().height() / 2
|
||||
);
|
||||
}
|
||||
|
||||
void QtWindow::keyPressEvent(QKeyEvent *event)
|
||||
@@ -331,6 +361,11 @@ void QtWindow::setupDone()
|
||||
|
||||
QSize size(qMax(actualSize.width(), preferredSize.width()), qMax(actualSize.height(), preferredSize.height()));
|
||||
resize(size);
|
||||
|
||||
move(
|
||||
parentWidget()->pos().x() + parentWidget()->width() / 2 - size.width() / 2,
|
||||
parentWidget()->pos().y() + parentWidget()->height() / 2 - size.height() / 2
|
||||
);
|
||||
}
|
||||
|
||||
void QtWindow::addLogo()
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QResizeEvent>
|
||||
#include <QSizeGrip>
|
||||
#include <QWidget>
|
||||
|
||||
#include "qt/window/QtWindowStack.h"
|
||||
@@ -71,6 +72,7 @@ protected:
|
||||
void addLogo();
|
||||
|
||||
QWidget* m_window;
|
||||
QWidget* m_content;
|
||||
|
||||
QLabel* m_title;
|
||||
|
||||
@@ -92,6 +94,8 @@ private:
|
||||
|
||||
QPoint m_dragPosition;
|
||||
bool m_mousePressedInWindow;
|
||||
|
||||
QSizeGrip* m_sizeGrip;
|
||||
};
|
||||
|
||||
#endif // QT_WINDOW_H
|
||||
|
||||
@@ -555,8 +555,7 @@ void QtProjectWizzard::showSummary()
|
||||
|
||||
void QtProjectWizzard::createProject()
|
||||
{
|
||||
std::string path = m_settings.getProjectFileLocation().str() + "/" + m_settings.getProjectName() + ".coatiproject";
|
||||
|
||||
FilePath path(m_settings.getProjectFileLocation().str() + "/" + m_settings.getProjectName() + ".coatiproject");
|
||||
m_settings.save(path);
|
||||
|
||||
bool edited = false;
|
||||
|
||||
@@ -105,15 +105,16 @@ bool QtProjectWizzardContentPaths::check()
|
||||
|
||||
if (!fi.exists())
|
||||
{
|
||||
missingPaths.append("\n");
|
||||
missingPaths.append(f.str().c_str());
|
||||
missingPaths.append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!missingPaths.isEmpty())
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("These paths do not exist:" + missingPaths);
|
||||
msgBox.setText("Some project paths do not exist.");
|
||||
msgBox.setDetailedText(missingPaths);
|
||||
msgBox.exec();
|
||||
return false;
|
||||
}
|
||||
@@ -191,12 +192,7 @@ void QtProjectWizzardContentPaths::detectionClicked()
|
||||
}
|
||||
|
||||
std::vector<FilePath> oldPaths = m_list->getList();
|
||||
|
||||
std::set<FilePath> uniquePaths;
|
||||
uniquePaths.insert(oldPaths.begin(), oldPaths.end());
|
||||
uniquePaths.insert(paths.begin(), paths.end());
|
||||
|
||||
m_list->setList(utility::toVector(uniquePaths));
|
||||
m_list->setList(utility::unique(utility::concat(oldPaths, paths)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "utility/file/FileRegister.h"
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/text/TextAccess.h"
|
||||
#include "utility/tracing.h"
|
||||
|
||||
#include "data/parser/cxx/ASTActionFactory.h"
|
||||
#include "data/parser/cxx/CxxCompilationDatabaseSingle.h"
|
||||
@@ -105,6 +106,9 @@ std::vector<std::string> CxxParser::getCommandlineArgumentsEssential(const Argum
|
||||
// The option -c signals that no executable is built.
|
||||
args.push_back("-c");
|
||||
|
||||
// The option -w disables all warnings.
|
||||
args.push_back("-w");
|
||||
|
||||
args.insert(args.begin(), arguments.compilerFlags.begin(), arguments.compilerFlags.end());
|
||||
|
||||
for (const FilePath& path : arguments.headerSearchPaths)
|
||||
@@ -195,6 +199,8 @@ void CxxParser::setupParsingCDB(const Arguments& arguments)
|
||||
|
||||
void CxxParser::runTool(const std::vector<std::string>& files)
|
||||
{
|
||||
TRACE();
|
||||
|
||||
clang::tooling::ClangTool tool(*m_compilationDatabase, files);
|
||||
tool.setDiagnosticConsumer(m_diagnostics.get());
|
||||
|
||||
@@ -204,6 +210,8 @@ void CxxParser::runTool(const std::vector<std::string>& files)
|
||||
|
||||
void CxxParser::runTool(clang::tooling::CompileCommand command, const Arguments& arguments)
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::vector<std::string> args = getCommandlineArgumentsEssential(arguments);
|
||||
command.CommandLine.insert(command.CommandLine.end(), args.begin(), args.end());
|
||||
|
||||
|
||||
@@ -50,21 +50,14 @@ void PreprocessorCallbacks::InclusionDirective(
|
||||
clang::CharSourceRange fileNameRange, const clang::FileEntry* fileEntry, llvm::StringRef searchPath,
|
||||
llvm::StringRef relativePath, const clang::Module* imported
|
||||
){
|
||||
const clang::FileEntry* baseFileEntry = m_sourceManager.getFileEntryForID(m_sourceManager.getFileID(hashLocation));
|
||||
if (fileEntry && baseFileEntry)
|
||||
if (!m_currentPath.empty() && fileEntry)
|
||||
{
|
||||
FilePath baseFilePath = FilePath(baseFileEntry->getName()).canonical();
|
||||
if (!m_fileRegister->hasFilePath(baseFilePath) || m_fileRegister->fileIsParsed(baseFilePath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FilePath includedFilePath = FilePath(fileEntry->getName()).canonical();
|
||||
if (m_fileRegister->hasFilePath(includedFilePath))
|
||||
{
|
||||
m_client->onFileIncludeParsed(
|
||||
getParseLocation(fileNameRange.getAsRange()),
|
||||
m_fileRegister->getFileInfo(baseFilePath),
|
||||
m_fileRegister->getFileInfo(m_currentPath),
|
||||
m_fileRegister->getFileInfo(includedFilePath)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
int order = 0;
|
||||
TestTask task(&order, 1);
|
||||
|
||||
task.execute();
|
||||
task.executeTask();
|
||||
|
||||
TS_ASSERT_EQUALS(3, order);
|
||||
|
||||
|
||||
@@ -41,21 +41,21 @@ public:
|
||||
TS_ASSERT_EQUALS("Coati", solutionName);
|
||||
}
|
||||
|
||||
void test_get_include_paths()
|
||||
{
|
||||
SolutionParserVisualStudio parser;
|
||||
parser.openSolutionFile("data/vsSolutionParserTestSuite/Coati.sln");
|
||||
std::vector<std::string> includePaths = parser.getIncludePathsNonCanonical();
|
||||
// void test_get_include_paths()
|
||||
// {
|
||||
// SolutionParserVisualStudio parser;
|
||||
// parser.openSolutionFile("data/vsSolutionParserTestSuite/Coati.sln");
|
||||
// std::vector<std::string> includePaths = parser.getIncludePathsNonCanonical();
|
||||
|
||||
TS_ASSERT_EQUALS(24, includePaths.size());
|
||||
}
|
||||
// TS_ASSERT_EQUALS(24, includePaths.size());
|
||||
// }
|
||||
|
||||
void test_get_()
|
||||
{
|
||||
SolutionParserVisualStudio parser;
|
||||
parser.openSolutionFile("data/vsSolutionParserTestSuite/Coati.sln");
|
||||
std::vector<std::string> projectItems = parser.getProjectItemsNonCanonical();
|
||||
// void test_get_()
|
||||
// {
|
||||
// SolutionParserVisualStudio parser;
|
||||
// parser.openSolutionFile("data/vsSolutionParserTestSuite/Coati.sln");
|
||||
// std::vector<std::string> projectItems = parser.getProjectItemsNonCanonical();
|
||||
|
||||
TS_ASSERT_EQUALS(450, projectItems.size());
|
||||
}
|
||||
// TS_ASSERT_EQUALS(450, projectItems.size());
|
||||
// }
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user