ui: Errorview

Tabbed view with errorview as tab
This commit is contained in:
Andreas Stallinger
2016-10-13 12:37:10 +02:00
parent 97b151371b
commit dc064e4756
82 changed files with 1641 additions and 197 deletions
-2
View File
@@ -39,7 +39,6 @@ set(CMAKE_BUILD_TYPE_INIT "Release")
#RPATH
if(UNIX AND NOT APPLE)
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib/:$$ORIGIN/lib/")
include(cmake/external.cmake)
@@ -367,7 +366,6 @@ create_source_groups(${APP_FILES})
target_link_libraries(${APP_PROJECT_NAME} ${LIB_GUI_PROJECT_NAME} ${LIB_CXX_PROJECT_NAME} ${LIB_JAVA_PROJECT_NAME} ${LIB_PROJECT_NAME} ${LIB_LICENSE_PROJECT_NAME})
set_property(
TARGET ${APP_PROJECT_NAME}
PROPERTY INCLUDE_DIRECTORIES
@@ -393,4 +393,26 @@
</aggregation>
</edge>
</graph>
<error>
<background>#272728</background>
<table>white</table>
<text>
<normal>white</normal>
<active>black</active>
</text>
<table_line_1>
<normal>darkgrey</normal>
<active>white</active>
</table_line_1>
<table_line_2>
<normal>#343434</normal>
<active>white</active>
</table_line_2>
</error>
<tab>
<background>#272728</background>
<active>white</active>
<hover>#878787</hover>
<text>#878787</text>
</tab>
</config>
+22
View File
@@ -359,4 +359,26 @@
</aggregation>
</edge>
</graph>
<error>
<background>white</background>
<table>#aaa</table>
<text>
<normal>black</normal>
<active>white</active>
</text>
<table_line_1>
<normal>white</normal>
<active>grey</active>
</table_line_1>
<table_line_2>
<normal>#F1F1F1</normal>
<active>grey</active>
</table_line_2>
</error>
<tab>
<background>white</background>
<active>black</active>
<hover>#878787</hover>
<text>#878787</text>
</tab>
</config>
+22
View File
@@ -388,4 +388,26 @@
</aggregation>
</edge>
</graph>
<error>
<background>#272728</background>
<table>white</table>
<text>
<normal>white</normal>
<active>black</active>
</text>
<table_line_1>
<normal>darkgrey</normal>
<active>white</active>
</table_line_1>
<table_line_2>
<normal>#343434</normal>
<active>white</active>
</table_line_2>
</error>
<tab>
<background>#272728</background>
<active>white</active>
<hover>#878787</hover>
<text>#878787</text>
</tab>
</config>
@@ -0,0 +1,90 @@
QTableView {
color: <color:error/text/normal>;
background-color: <color:error/table_line_1/normal>;
alternate-background-color: <color:error/table_line_2/normal>;
border-radius: 10px;
border: 1px solid <color:error/table>;
margin: 10px;
padding-right: 10px;
font-size: <setting:font_size>px;
}
QFrame {
background-color: <color:error/background>;
}
QTableView::item {
border-left: 1px solid <color:error/table>;
}
QTableView::item:selected {
color: <color:error/text/active>;
background-color: <color:error/table_line_1/active>;
alternate-background-color: <color:error/table_line_2/active>;
}
QHeaderView {
background-color: transparent;
}
QHeaderView::section:horizontal {
background-color: transparent;
border: none;
border-bottom: 1px solid <color:error/table>;
border-left: 1px solid <color:error/table>;
color: <color:error/text/normal>;
font-size: <setting:font_size>px;
font-weight: bold;
padding: 1px 6px;
height: <setting:font_size+5>px;;
}
QCheckBox {
color: <color:error/text/normal>;
border-color: <color:error/table>;
/*background-color: <color:error/table>;*/
}
QHeaderView::section:vertical {
background-color: transparent;
border: none;
color: <color:error/text/normal>;
font-size: <setting:font_size>px;
padding-right: 5px;
padding-left: 5px;
}
QScrollBar:vertical {
}
QScrollBar::handle:vertical {
min-height: 20px;
}
QScrollBar::add-line:vertical {
height: 20px;
subcontrol-position: bottom;
subcontrol-origin: margin;
}
QScrollBar::sub-line:vertical {
height: 20px;
subcontrol-position: top;
subcontrol-origin: margin;
}
QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical {
width: 3px;
height: 3px;
background: white;
}
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
background: none;
}
QTableView QTableCornerButton::section {
background-color: <color:error/background>;
border-bottom: 1px solid <color:error/table>;
border-top-left-radius: 10px;
}
+1
View File
@@ -3,3 +3,4 @@ QToolTip {
color: black;
font-size: <setting:font_size>px;
}
@@ -0,0 +1,31 @@
QTabWidget::tab-bar {
alignment: left;
}
QTabBar::tab {
background-color: <color:tab/background>;
color: <color:tab/text>;
padding: 12px 75px 5px 12px;
border: 0px;
border-bottom: 4px solid <color:tab/background>;
/*font-size: <setting:font_size>px;*/
/*font-weight: bold;*/
}
QTabBar::tab:hover {
border-bottom: 4px solid <color:tab/hover>;
}
QTabBar::tab:selected {
border-bottom: 4px solid <color:tab/active>;
color: <color:tab/active>;
}
QTabWidget::pane {
top: 0px;
background: <color:tab/background>;
color: <color:tab/text>;
border: 0px;
margin: 0px;
padding: 0px;
}
@@ -8,7 +8,7 @@ Field::Token Field::Opponent( Token token ) {
} else if (token == PlayerB){
return PlayerA;
} else {
return None;
return Non;
}
}
@@ -100,7 +100,7 @@ bool Field::InRange( const Move& move ) const {
}
bool Field::IsEmpty( const Move& move ) const {
return grid_[move.row][move.col] == None;
return grid[move.row][move.col] == None;
}
bool Field::IsFull() const {
@@ -11,7 +11,7 @@ HumanPlayer::~HumanPlayer() {
Field::Move HumanPlayer::Turn( const Field& field ) const {
Field::Move move;
io::stringOut(name_);
io::stringOu(name_);
io::stringOut("\n");
do {
@@ -33,13 +33,13 @@ Field::Move HumanPlayer::Input() const {
io::stringOut("Insert column: ");
move.col = io::numberIn();
io::stringOut("\n");
io::tringOut("\n");
return move;
}
bool HumanPlayer::Check( const Field& field, const Field::Move& move ) const {
if ( !field.InRange( move ) ) {
io::stringOut("Wrong input!\n");
io::stringOut("Wrong input!\n")
return false;
} else if ( !field.IsEmpty( move ) ) {
io::stringOut("Is occupied!\n");
@@ -1,6 +1,6 @@
#include "tictactoe.h"
#include "artificial_player.h"
#include "artificia_player.h"
#include "human_player.h"
#include "io.h"
@@ -29,8 +29,6 @@
<indexing>
<indexer_thread_count><!-- INTEGER: number of threads indexing the source code --></indexer_thread_count>
<show_external_non_fatal_errors><!-- BOOL: show non-fatal errors in unindexed files --></show_external_non_fatal_errors>
<cxx>
<compiler_flags>
<compiler_flag><!-- STRING: compiler flag, including the dash e.g. -v --></compiler_flag>
+31 -16
View File
@@ -1,21 +1,33 @@
#pre install script
function(Print text)
execute_process(
COMMAND echo ${text}
)
endfunction()
function(Run)
execute_process(
COMMAND ${ARGV}
)
endfunction()
# upx
set(upxPath ${CMAKE_CURRENT_LIST_DIR}/../bin/app/Release)
set(upxPath ${CMAKE_CURRENT_LIST_DIR}/../bin/app/Release)
execute_process(
COMMAND ${upxPath}/Coati -z /home/vagrant/dev/license.txt
)
execute_process(
COMMAND ${upxPath}/Coati -z /home/vagrant/dev/license.txt
)
execute_process(
COMMAND ${upxPath}/Coati -f -d ${upxPath}/../data/projects/tictactoe/tictactoe.coatiproject
)
execute_process(
COMMAND ${upxPath}/Coati -f -d ${upxPath}/../data/projects/tictactoe/tictactoe.coatiproject
)
execute_process(
COMMAND ${upxPath}/Coati -f -d ${upxPath}/../data/projects/tutorial/tutorial.coatiproject
)
execute_process(
COMMAND ${upxPath}/Coati -f -d ${upxPath}/../data/projects/tutorial/tutorial.coatiproject
)
#execute_process(
#COMMAND ${upxPath}/Coati -f -d ${upxPath}/../data/projects/javaparser/javaparser.coatiproject
#COMMAND ${upxPath}/Coati -f -d ${upxPath}/../data/projects/javaparser/javaparser.coatiproject
#)
#SET (NO_UPX 1)
@@ -29,11 +41,14 @@ if (NO_UPX)
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${upxPath}/Coati ${upxPath}/Coati_upx
)
else()
message(STATUS "upx the app")
execute_process(
COMMAND rm ${upxPath}/Coati_upx
COMMAND upx --brute ${upxPath}/Coati -o ${upxPath}/Coati_upx
)
Print("Remove old Coati_upx")
Run(rm ${upxPath}/Coati_upx)
Print("upx Coati")
Run(upx --brute ${upxPath}/Coati -o ${upxPath}/Coati_upx)
Print("Remove old Coati_trial_upx")
Run(rm ${upxPath}/Coati_trial_upx)
Print("upx Coati_trial")
Run(upx --brute ${upxPath}/Coati_trial -o ${upxPath}/Coati_trial_upx)
endif()
#add_custom_command(
#OUTPUT Coati_upx
+1 -1
View File
@@ -38,7 +38,7 @@ then
elif [ "$1" = "package" ] || [ "$1" = "p" ]
then
cmake --build build/Release --target package
mkdir -p distr && cp build/Release/Coati*.tar.gz distr #&& cp build/Release/Coati*.deb distr
mkdir -p distr && mv build/Release/Coati*.tar.gz distr #&& cp build/Release/Coati*.deb distr
echo "Packages copied into the distr folder"
else
echo "no arguments: first argument 'release' or 'debug', second argument 'test' for tests"
+13 -1
View File
@@ -17,13 +17,16 @@ add_files(
component/controller/CodeController.h
component/controller/Controller.cpp
component/controller/Controller.h
component/controller/ErrorController.cpp
component/controller/ErrorController.h
component/controller/FeatureController.cpp
component/controller/FeatureController.h
component/controller/GraphController.cpp
component/controller/GraphController.h
component/controller/IDECommunicationController.cpp
component/controller/IDECommunicationController.h
component/controller/LogController.cpp
component/controller/LogController.h
component/controller/NetworkFactory.cpp
component/controller/NetworkFactory.h
component/controller/RefreshController.cpp
@@ -43,11 +46,15 @@ add_files(
component/view/CompositeView.h
component/view/DialogView.cpp
component/view/DialogView.h
component/view/ErrorView.cpp
component/view/ErrorView.h
component/view/GraphView.cpp
component/view/GraphView.h
component/view/GraphViewStyle.cpp
component/view/GraphViewStyle.h
component/view/GraphViewStyleImpl.h
component/view/LogView.cpp
component/view/LogView.h
component/view/MainView.cpp
component/view/MainView.h
component/view/RefreshView.cpp
@@ -56,6 +63,8 @@ add_files(
component/view/SearchView.h
component/view/StatusBarView.cpp
component/view/StatusBarView.h
component/view/TabbedView.cpp
component/view/TabbedView.h
component/view/UndoRedoView.cpp
component/view/UndoRedoView.h
component/view/View.cpp
@@ -165,6 +174,7 @@ add_files(
data/DefinitionType.cpp
data/DefinitionType.h
data/ErrorCountInfo.h
data/ErrorFilter.h
data/ErrorInfo.h
data/HierarchyCache.cpp
data/HierarchyCache.h
@@ -260,6 +270,7 @@ add_files(
utility/messaging/type/MessageDeactivateEdge.h
utility/messaging/type/MessageDispatchWhenLicenseValid.h
utility/messaging/type/MessageEnteredLicense.h
utility/messaging/type/MessageErrorFilterChanged.h
utility/messaging/type/MessageFind.h
utility/messaging/type/MessageFinishedParsing.h
utility/messaging/type/MessageFlushUpdates.h
@@ -272,6 +283,7 @@ add_files(
utility/messaging/type/MessageInterruptTasks.h
utility/messaging/type/MessageLoadProject.h
utility/messaging/type/MessageMoveIDECursor.h
utility/messaging/type/MessageNewErrors.h
utility/messaging/type/MessagePluginPortChange.h
utility/messaging/type/MessageProjectEdit.h
utility/messaging/type/MessageProjectNew.h
+3 -5
View File
@@ -289,10 +289,6 @@ bool Project::buildIndex(bool forceRefresh)
MessageStatus("Nothing to refresh, all files are up-to-date.").dispatch();
return false;
}
else
{
MessageClearErrorCount().dispatch();
}
if (Application::getInstance()->hasGUI())
{
@@ -304,6 +300,8 @@ bool Project::buildIndex(bool forceRefresh)
}
}
MessageClearErrorCount().dispatch();
if (forceRefresh)
{
m_storage->clear();
@@ -353,7 +351,7 @@ bool Project::buildIndex(bool forceRefresh)
taskRepeat->setTask(std::make_shared<TaskInjectStorage>(storageProvider, m_storage));
}
taskSequential->addTask(std::make_shared<TaskFinishParsing>(m_storage.get(), fileRegister, m_dialogView));
taskSequential->addTask(std::make_shared<TaskFinishParsing>(m_storage.get(), m_storageAccessProxy, fileRegister, m_dialogView));
Task::dispatch(taskSequential);
+20
View File
@@ -2,14 +2,18 @@
#include "component/Component.h"
#include "component/controller/CodeController.h"
#include "component/controller/ErrorController.h"
#include "component/controller/FeatureController.h"
#include "component/controller/GraphController.h"
#include "component/controller/LogController.h"
#include "component/controller/RefreshController.h"
#include "component/controller/SearchController.h"
#include "component/controller/StatusBarController.h"
#include "component/controller/UndoRedoController.h"
#include "component/view/CodeView.h"
#include "component/view/ErrorView.h"
#include "component/view/GraphView.h"
#include "component/view/LogView.h"
#include "component/view/RefreshView.h"
#include "component/view/SearchView.h"
#include "component/view/StatusBarView.h"
@@ -43,6 +47,22 @@ std::shared_ptr<Component> ComponentFactory::createCodeComponent(ViewLayout* vie
return std::make_shared<Component>(view, controller);
}
std::shared_ptr<Component> ComponentFactory::createErrorComponent(ViewLayout* viewLayout)
{
std::shared_ptr<ErrorView> view = m_viewFactory->createErrorView(viewLayout);
std::shared_ptr<ErrorController> controller = std::make_shared<ErrorController>(m_storageAccess);
return std::make_shared<Component>(view, controller);
}
std::shared_ptr<Component> ComponentFactory::createLogComponent(ViewLayout* viewLayout)
{
std::shared_ptr<LogView> view = m_viewFactory->createLogView(viewLayout);
std::shared_ptr<LogController> controller = std::make_shared<LogController>(m_storageAccess);
return std::make_shared<Component>(view, controller);
}
std::shared_ptr<Component> ComponentFactory::createFeatureComponent()
{
std::shared_ptr<Controller> controller = std::make_shared<FeatureController>(m_storageAccess);
+2
View File
@@ -19,8 +19,10 @@ public:
ViewFactory* getViewFactory() const;
std::shared_ptr<Component> createCodeComponent(ViewLayout* viewLayout);
std::shared_ptr<Component> createErrorComponent(ViewLayout* viewLayout);
std::shared_ptr<Component> createFeatureComponent();
std::shared_ptr<Component> createGraphComponent(ViewLayout* viewLayout);
std::shared_ptr<Component> createLogComponent(ViewLayout* viewLayout);
std::shared_ptr<Component> createRefreshComponent(ViewLayout* viewLayout);
std::shared_ptr<Component> createSearchComponent(ViewLayout* viewLayout);
std::shared_ptr<Component> createStatusBarComponent(ViewLayout* viewLayout);
+17
View File
@@ -7,8 +7,10 @@
#include "component/view/CompositeView.h"
#include "component/view/DialogView.h"
#include "component/view/GraphView.h"
#include "component/view/LogView.h"
#include "component/view/RefreshView.h"
#include "component/view/SearchView.h"
#include "component/view/TabbedView.h"
#include "component/view/UndoRedoView.h"
#include "component/view/ViewFactory.h"
@@ -53,6 +55,16 @@ void ComponentManager::setup(ViewLayout* viewLayout)
m_components.push_back(featureComponent);
m_dialogView = m_componentFactory->getViewFactory()->createDialogView(viewLayout);
std::shared_ptr<TabbedView> tabbedView =
m_componentFactory->getViewFactory()->createTabbedView(viewLayout, "Log");
m_tabbedViews.push_back(tabbedView);
std::shared_ptr<Component> errorComponent = m_componentFactory->createErrorComponent(tabbedView.get());
m_components.push_back(errorComponent);
//std::shared_ptr<Component> logComponent = m_componentFactory->createLogComponent(tabbedView.get());
//m_components.push_back(logComponent);
}
void ComponentManager::clearComponents()
@@ -84,6 +96,11 @@ void ComponentManager::refreshViews()
{
view->refreshView();
}
for (std::shared_ptr<TabbedView> view : m_tabbedViews)
{
view->refreshView();
}
}
DialogView* ComponentManager::getDialogView() const
+2
View File
@@ -11,6 +11,7 @@ class CompositeView;
class DialogView;
class NetworkFactory;
class StorageAccess;
class TabbedView;
class View;
class ViewFactory;
class ViewLayout;
@@ -36,6 +37,7 @@ private:
std::shared_ptr<ComponentFactory> m_componentFactory;
std::vector<std::shared_ptr<CompositeView>> m_compositeViews;
std::vector<std::shared_ptr<TabbedView>> m_tabbedViews;
std::vector<std::shared_ptr<Component>> m_components;
std::shared_ptr<DialogView> m_dialogView;
@@ -272,16 +272,24 @@ void CodeController::handleMessage(MessageShowErrors* message)
{
TRACE("code errors");
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>());
if (!view->showsErrors() || !message->errorId)
{
std::vector<ErrorInfo> errors;
m_collection = m_storageAccess->getErrorTokenLocations(&errors);
std::vector<CodeSnippetParams> snippets = getSnippetsForCollection(m_collection);
showContents(message);
view->clear();
view->setErrorInfos(errors);
view->showCodeSnippets(snippets, std::vector<Id>());
showContents(message);
}
if (message->errorId)
{
view->showActiveSnippet(std::vector<Id>(1, message->errorId), m_collection, true);
}
}
void CodeController::handleMessage(MessageSearchFullText* message)
@@ -0,0 +1,68 @@
#include "component/controller/ErrorController.h"
#include "data/access/StorageAccess.h"
ErrorController::ErrorController(StorageAccess* storageAccess)
: m_storageAccess(storageAccess)
{
}
ErrorController::~ErrorController()
{
}
void ErrorController::handleMessage(MessageClearErrorCount* message)
{
clear();
}
void ErrorController::handleMessage(MessageFinishedParsing* message)
{
clear();
auto errors = m_storageAccess->getAllErrors();
for (const StorageError& error : errors)
{
getView()->addError(error);
}
}
void ErrorController::handleMessage(MessageNewErrors* message)
{
for (const StorageError& error : message->errors)
{
getView()->addError(error);
}
getView()->showDockWidget();
}
void ErrorController::handleMessage(MessageShowErrors* message)
{
if (message->errorId)
{
return;
}
clear();
auto errors = m_storageAccess->getAllErrors();
for (const StorageError& error : errors)
{
getView()->addError(error);
}
getView()->showDockWidget();
}
ErrorView* ErrorController::getView() const
{
return Controller::getView<ErrorView>();
}
void ErrorController::clear()
{
getView()->clear();
}
@@ -0,0 +1,39 @@
#ifndef ERROR_CONTROLLER_H
#define ERROR_CONTROLLER_H
#include "utility/messaging/MessageListener.h"
#include "utility/messaging/type/MessageClearErrorCount.h"
#include "utility/messaging/type/MessageFinishedParsing.h"
#include "utility/messaging/type/MessageNewErrors.h"
#include "utility/messaging/type/MessageShowErrors.h"
#include "component/controller/Controller.h"
#include "component/view/ErrorView.h"
class StorageAccess;
class ErrorController
: public Controller
, public MessageListener<MessageClearErrorCount>
, public MessageListener<MessageFinishedParsing>
, public MessageListener<MessageNewErrors>
, public MessageListener<MessageShowErrors>
{
public:
ErrorController(StorageAccess* storageAccess);
~ErrorController();
private:
virtual void handleMessage(MessageClearErrorCount* message);
virtual void handleMessage(MessageFinishedParsing* message);
virtual void handleMessage(MessageNewErrors* message);
virtual void handleMessage(MessageShowErrors* message);
ErrorView* getView() const;
virtual void clear();
StorageAccess* m_storageAccess;
};
#endif // ERROR_CONTROLLER_H
@@ -137,7 +137,7 @@ void FeatureController::handleMessage(MessageSearch* message)
case SearchMatch::COMMAND_ERROR:
{
MessageShowErrors msg(m_storageAccess->getErrorCount());
MessageShowErrors msg(m_storageAccess->getFilteredErrorCount());
msg.setIsReplayed(message->isReplayed());
msg.dispatchImmediately();
return;
@@ -0,0 +1,22 @@
#include "component/controller/LogController.h"
#include "data/access/StorageAccess.h"
LogController::LogController(StorageAccess* storageAccess)
: m_storageAccess(storageAccess)
{
}
LogController::~LogController()
{
}
LogView* LogController::getView() const
{
return Controller::getView<LogView>();
}
void LogController::clear()
{
getView()->clear();
}
@@ -0,0 +1,24 @@
#ifndef LOG_CONTROLLER_H
#define LOG_CONTROLLER_H
#include "component/controller/Controller.h"
#include "component/view/LogView.h"
class StorageAccess;
class LogController
: public Controller
{
public:
LogController(StorageAccess* storageAccess);
~LogController();
private:
LogView* getView() const;
virtual void clear();
StorageAccess* m_storageAccess;
};
#endif // LOG_CONTROLLER_H
@@ -31,17 +31,22 @@ void StatusBarController::handleMessage(MessageClearErrorCount* message)
void StatusBarController::handleMessage(MessageFinishedParsing* message)
{
ErrorCountInfo errorCount = m_storageAccess->getErrorCount();
ErrorCountInfo errorCount = m_storageAccess->getFilteredErrorCount();
getView()->setErrorCount(errorCount);
}
void StatusBarController::handleMessage(MessageRefresh* message)
{
getView()->setErrorCount(m_storageAccess->getErrorCount());
getView()->setErrorCount(m_storageAccess->getFilteredErrorCount());
}
void StatusBarController::handleMessage(MessageShowErrors* message)
{
if (message->errorId)
{
return;
}
getView()->setErrorCount(message->errorCount);
}
+1
View File
@@ -31,6 +31,7 @@ public:
virtual void clear() = 0;
virtual void setErrorInfos(const std::vector<ErrorInfo>& errorInfos) = 0;
virtual bool showsErrors() const = 0;
virtual void showCodeSnippets(const std::vector<CodeSnippetParams>& snippets, const std::vector<Id>& activeTokenIds) = 0;
virtual void addCodeSnippets(const std::vector<CodeSnippetParams>& snippets, bool insert) = 0;
+2 -12
View File
@@ -1,5 +1,7 @@
#include "component/view/CompositeView.h"
#include <algorithm>
CompositeView::CompositeView(ViewLayout* viewLayout, CompositeDirection direction, const std::string& name)
: View(viewLayout)
, m_direction(direction)
@@ -46,20 +48,8 @@ void CompositeView::removeView(View* view)
void CompositeView::showView(View* view)
{
getViewLayout()->showView(view);
}
void CompositeView::hideView(View* view)
{
getViewLayout()->hideView(view);
}
void CompositeView::loadLayout()
{
getViewLayout()->loadLayout();
}
void CompositeView::saveLayout()
{
getViewLayout()->saveLayout();
}
-3
View File
@@ -35,9 +35,6 @@ public:
virtual void showView(View* view);
virtual void hideView(View* view);
virtual void loadLayout();
virtual void saveLayout();
private:
std::vector<View*> m_views;
CompositeDirection m_direction;
+20
View File
@@ -0,0 +1,20 @@
#include "component/view/ErrorView.h"
ErrorView::ErrorView(ViewLayout* viewLayout)
: View(viewLayout)
{
}
ErrorView::~ErrorView()
{
}
std::string ErrorView::getName() const
{
return "Errors";
}
void ErrorView::showDockWidget()
{
getViewLayout()->showView(this);
}
+23
View File
@@ -0,0 +1,23 @@
#ifndef ERROR_VIEW_H
#define ERROR_VIEW_H
#include "component/view/View.h"
#include "data/StorageTypes.h"
class ErrorView
: public View
{
public:
ErrorView(ViewLayout* viewLayout);
virtual ~ErrorView();
virtual std::string getName() const;
virtual void showDockWidget();
virtual void clear() = 0;
virtual void addError(const StorageError& error) = 0;
};
#endif // ERROR_VIEW_H
+3
View File
@@ -1,6 +1,9 @@
#ifndef GRAPH_VIEW_H
#define GRAPH_VIEW_H
#include <vector>
#include "utility/math/Vector2.h"
#include "utility/types.h"
#include "component/view/View.h"
+15
View File
@@ -0,0 +1,15 @@
#include "component/view/LogView.h"
LogView::LogView(ViewLayout* viewLayout)
: View(viewLayout)
{
}
LogView::~LogView()
{
}
std::string LogView::getName() const
{
return "Logs";
}
+18
View File
@@ -0,0 +1,18 @@
#ifndef LOG_VIEW_H
#define LOG_VIEW_H
#include "component/view/View.h"
class LogView
: public View
{
public:
LogView(ViewLayout* viewLayout);
virtual ~LogView();
virtual std::string getName() const;
virtual void clear() = 0;
};
#endif // LOG_VIEW_H
+3
View File
@@ -13,6 +13,9 @@ public:
MainView();
virtual ~MainView();
virtual void loadLayout() = 0;
virtual void saveLayout() = 0;
virtual void hideStartScreen() = 0;
virtual void setTitle(const std::string& title) = 0;
virtual void activateWindow() = 0;
+51
View File
@@ -0,0 +1,51 @@
#include "component/view/TabbedView.h"
#include <algorithm>
TabbedView::TabbedView(ViewLayout* viewLayout, const std::string& name)
: View(viewLayout)
, m_name(name)
{
}
TabbedView::~TabbedView()
{
}
const std::vector<View*>& TabbedView::getViews() const
{
return m_views;
}
std::string TabbedView::getName() const
{
return m_name;
}
void TabbedView::addView(View* view)
{
m_views.push_back(view);
addViewWidget(view);
}
void TabbedView::removeView(View* view)
{
std::vector<View*>::iterator it = std::find(m_views.begin(), m_views.end(), view);
if (it == m_views.end())
{
return;
}
m_views.erase(it);
}
void TabbedView::showView(View* view)
{
getViewLayout()->showView(view);
}
void TabbedView::hideView(View* view)
{
getViewLayout()->hideView(view);
}
+37
View File
@@ -0,0 +1,37 @@
#ifndef TABBED_VIEW_H
#define TABBED_VIEW_H
#include <vector>
#include "component/view/View.h"
#include "component/view/ViewLayout.h"
class TabbedView
: public View
, public ViewLayout
{
public:
TabbedView(ViewLayout* viewLayout, const std::string& name);
virtual ~TabbedView();
const std::vector<View*>& getViews() const;
virtual void addViewWidget(View* view) = 0;
// View implementation
virtual std::string getName() const;
// ViewLayout implementation
virtual void addView(View* view);
virtual void removeView(View* view);
virtual void showView(View* view);
virtual void hideView(View* view);
private:
std::vector<View*> m_views;
std::string m_name;
};
#endif // TABBED_VIEW_H
-1
View File
@@ -6,7 +6,6 @@
#include "component/Component.h"
#include "component/view/ViewLayout.h"
#include "utility/math/Vector2.h"
class ViewWidgetWrapper;
+6
View File
@@ -7,11 +7,14 @@
class CodeView;
class DialogView;
class ErrorView;
class GraphView;
class MainView;
class LogView;
class RefreshView;
class SearchView;
class StatusBarView;
class TabbedView;
class UndoRedoView;
class ViewLayout;
@@ -24,9 +27,12 @@ public:
virtual std::shared_ptr<MainView> createMainView() const = 0;
virtual std::shared_ptr<CompositeView> createCompositeView(
ViewLayout* viewLayout, CompositeView::CompositeDirection direction, const std::string& name) const = 0;
virtual std::shared_ptr<TabbedView> createTabbedView(ViewLayout* viewLayout, const std::string& name) const = 0;
virtual std::shared_ptr<CodeView> createCodeView(ViewLayout* viewLayout) const = 0;
virtual std::shared_ptr<ErrorView> createErrorView(ViewLayout* viewLayout) const = 0;
virtual std::shared_ptr<GraphView> createGraphView(ViewLayout* viewLayout) const = 0;
virtual std::shared_ptr<LogView> createLogView(ViewLayout* viewLayout) const = 0;
virtual std::shared_ptr<RefreshView> createRefreshView(ViewLayout* viewLayout) const = 0;
virtual std::shared_ptr<SearchView> createSearchView(ViewLayout* viewLayout) const = 0;
virtual std::shared_ptr<StatusBarView> createStatusBarView(ViewLayout* viewLayout) const = 0;
-3
View File
@@ -14,9 +14,6 @@ public:
virtual void showView(View* view) = 0;
virtual void hideView(View* view) = 0;
virtual void loadLayout() = 0;
virtual void saveLayout() = 0;
};
#endif // VIEW_LAYOUT_H
+50
View File
@@ -0,0 +1,50 @@
#ifndef ERROR_FILTER_H
#define ERROR_FILTER_H
#include "data/ErrorInfo.h"
#include "data/StorageTypes.h"
struct ErrorFilter
{
ErrorFilter()
: error(true)
, fatal(true)
, unindexedError(false)
, unindexedFatal(true)
{
}
bool filter(const ErrorInfo& info) const
{
if (!error && !info.isFatal && info.isIndexed)
return false;
if (!fatal && info.isFatal && info.isIndexed)
return false;
if (!unindexedError && !info.isFatal && !info.isIndexed)
return false;
if (!unindexedFatal && info.isFatal && !info.isIndexed)
return false;
return true;
}
bool filter(const StorageError& storageError) const
{
if (!error && !storageError.fatal && storageError.indexed)
return false;
if (!fatal && storageError.fatal && storageError.indexed)
return false;
if (!unindexedError && !storageError.fatal && !storageError.indexed)
return false;
if (!unindexedFatal && storageError.fatal && !storageError.indexed)
return false;
return true;
}
bool error;
bool fatal;
bool unindexedError;
bool unindexedFatal;
};
#endif // ERROR_FILTER_H
+4 -1
View File
@@ -9,14 +9,16 @@ struct ErrorInfo
ErrorInfo()
: id(0)
, isFatal(false)
, isIndexed(false)
{
}
ErrorInfo(const std::string& message, const FilePath& filePath, Id id, bool isFatal)
ErrorInfo(const std::string& message, const FilePath& filePath, Id id, bool isFatal, bool isIndexed)
: message(message)
, filePath(filePath)
, id(id)
, isFatal(isFatal)
, isIndexed(isIndexed)
{
}
@@ -24,6 +26,7 @@ struct ErrorInfo
FilePath filePath;
Id id;
bool isFatal;
bool isIndexed;
};
#endif // ERROR_INFO_H
+1
View File
@@ -163,6 +163,7 @@ void IntermediateStorage::addCommentLocation(Id fileNodeId, uint startLine, uint
void IntermediateStorage::addError(const std::string& message, bool fatal, bool indexed, const std::string& filePath, uint startLine, uint startCol)
{
m_errors.push_back(StorageError(
0,
message,
fatal,
indexed,
+51 -57
View File
@@ -6,6 +6,8 @@
#include "utility/Cache.h"
#include "utility/file/FileSystem.h"
#include "utility/logging/logging.h"
#include "utility/messaging/type/MessageClearErrorCount.h"
#include "utility/messaging/type/MessageNewErrors.h"
#include "utility/messaging/type/MessageShowErrors.h"
#include "utility/messaging/type/MessageStatus.h"
#include "utility/text/TextAccess.h"
@@ -24,7 +26,6 @@
#include "data/location/TokenLocationLine.h"
#include "data/parser/ParseLocation.h"
#include "data/type/DataType.h"
#include "settings/ApplicationSettings.h"
PersistentStorage::PersistentStorage(const FilePath& dbPath)
: m_sqliteStorage(dbPath)
@@ -217,7 +218,7 @@ void PersistentStorage::forEachError(std::function<void(const StorageError& /*da
void PersistentStorage::startInjection()
{
m_preInjectionErrorCount = getErrorCount().total;
m_preInjectionErrorCount = m_sqliteStorage.getAllErrors().size();
m_sqliteStorage.beginTransaction();
}
@@ -226,12 +227,11 @@ void PersistentStorage::finishInjection()
{
m_sqliteStorage.commitTransaction();
ErrorCountInfo errorCount = getErrorCount();
if (m_preInjectionErrorCount != errorCount.total)
auto errors = m_sqliteStorage.getAllErrors();
if (m_preInjectionErrorCount != errors.size())
{
MessageShowErrors msg(errorCount);
msg.setSendAsTask(false);
msg.dispatchImmediately();
MessageNewErrors(std::vector<StorageError>(errors.begin() + m_preInjectionErrorCount, errors.end())).dispatchImmediately();
}
}
@@ -994,33 +994,6 @@ std::shared_ptr<TokenLocationFile> PersistentStorage::getTokenLocationsForLinesI
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>();
bool showExternalNonFatalErrors = ApplicationSettings::getInstance()->getShowExternalNonFatalErrors();
std::vector<StorageError> storageErrors = m_sqliteStorage.getAllErrors();
for (size_t i = 0; i < storageErrors.size(); i++)
{
const StorageError& error = storageErrors[i];
if (error.fatal || error.indexed || showExternalNonFatalErrors)
{
// Set first bit to 1 to avoid collisions
Id locationId = ~(~size_t(0) >> 1) + i;
errorCollection->addTokenLocation(
locationId, i, error.filePath, error.lineNumber, error.columnNumber, error.lineNumber, error.columnNumber
)->setType(LOCATION_ERROR);
errors->push_back(ErrorInfo(error.message, error.filePath, i, error.fatal));
}
}
return errorCollection;
}
std::shared_ptr<TokenLocationFile> PersistentStorage::getCommentLocationsInFile(const FilePath& filePath) const
{
TRACE();
@@ -1066,29 +1039,6 @@ std::vector<FileInfo> PersistentStorage::getFileInfosForFilePaths(const std::vec
return fileInfos;
}
ErrorCountInfo PersistentStorage::getErrorCount() const
{
bool showExternalNonFatalErrors = ApplicationSettings::getInstance()->getShowExternalNonFatalErrors();
ErrorCountInfo info;
std::vector<StorageError> storageErrors = m_sqliteStorage.getAllErrors();
for (const StorageError& error : storageErrors)
{
if (error.fatal || error.indexed || showExternalNonFatalErrors)
{
info.total++;
}
if (error.fatal)
{
info.fatal++;
}
}
return info;
}
StorageStats PersistentStorage::getStorageStats() const
{
TRACE();
@@ -1104,6 +1054,50 @@ StorageStats PersistentStorage::getStorageStats() const
return stats;
}
ErrorCountInfo PersistentStorage::getErrorCount() const
{
LOG_ERROR("This should never be called.");
return ErrorCountInfo();
}
ErrorCountInfo PersistentStorage::getFilteredErrorCount() const
{
LOG_ERROR("This should never be called.");
return ErrorCountInfo();
}
std::vector<StorageError> PersistentStorage::getAllErrors() const
{
return m_sqliteStorage.getAllErrors();
}
std::vector<StorageError> PersistentStorage::getFilteredErrors() const
{
LOG_ERROR("This should never be called.");
return std::vector<StorageError>();
}
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();
for (const StorageError& error : storageErrors)
{
// Set first bit to 1 to avoid collisions
Id locationId = ~(~size_t(0) >> 1) + error.id;
errorCollection->addTokenLocation(
locationId, error.id, error.filePath, error.lineNumber, error.columnNumber, error.lineNumber, error.columnNumber
)->setType(LOCATION_ERROR);
errors->push_back(ErrorInfo(error.message, error.filePath, error.id, error.fatal, error.indexed));
}
return errorCollection;
}
Id PersistentStorage::getFileNodeId(const FilePath& filePath) const
{
if (filePath.empty())
+8 -2
View File
@@ -106,7 +106,6 @@ public:
const std::string& filePath, uint firstLineNumber, uint lastLineNumber
) const;
virtual std::shared_ptr<TokenLocationCollection> getErrorTokenLocations(std::vector<ErrorInfo>* errors) const;
virtual std::shared_ptr<TokenLocationFile> getCommentLocationsInFile(const FilePath& filePath) const;
virtual std::shared_ptr<TextAccess> getFileContent(const FilePath& filePath) const;
@@ -114,9 +113,16 @@ public:
virtual FileInfo getFileInfoForFilePath(const FilePath& filePath) const;
virtual std::vector<FileInfo> getFileInfosForFilePaths(const std::vector<FilePath>& filePaths) const;
virtual ErrorCountInfo getErrorCount() const;
virtual StorageStats getStorageStats() const;
virtual ErrorCountInfo getErrorCount() const;
virtual ErrorCountInfo getFilteredErrorCount() const;
virtual std::vector<StorageError> getAllErrors() const;
virtual std::vector<StorageError> getFilteredErrors() const;
virtual std::shared_ptr<TokenLocationCollection> getErrorTokenLocations(std::vector<ErrorInfo>* errors) const;
private:
Id getFileNodeId(const FilePath& filePath) const;
FilePath getFileNodePath(Id fileId) const;
+4 -2
View File
@@ -217,7 +217,7 @@ Id SqliteStorage::addCommentLocation(Id fileNodeId, uint startLine, uint startCo
Id SqliteStorage::addError(const std::string& message, bool fatal, bool indexed, const std::string& filePath, uint lineNumber, uint columnNumber)
{
std::string sanitizedMessage = utility::replace((fatal ? "Fatal: " : "Error: ") + message, "'", "''");
std::string sanitizedMessage = utility::replace(message, "'", "''");
// check for duplicate
CppSQLite3Statement stmt = m_database.compileStatement((
@@ -1072,6 +1072,7 @@ std::vector<StorageError> SqliteStorage::getAll<StorageError>(const std::string&
).c_str());
std::vector<StorageError> errors;
Id id = 1;
while (!q.eof())
{
const std::string message = q.getStringField(0, "");
@@ -1083,7 +1084,8 @@ std::vector<StorageError> SqliteStorage::getAll<StorageError>(const std::string&
if (lineNumber != -1 && columnNumber != -1)
{
errors.push_back(StorageError(message, fatal, indexed, filePath, lineNumber, columnNumber));
errors.push_back(StorageError(id, message, fatal, indexed, filePath, lineNumber, columnNumber));
id++;
}
q.nextRow();
+6 -3
View File
@@ -169,7 +169,8 @@ struct StorageCommentLocation
struct StorageError
{
StorageError()
: message("")
: id(0)
, message("")
, fatal(0)
, indexed(0)
, filePath("")
@@ -177,8 +178,9 @@ struct StorageError
, columnNumber(-1)
{}
StorageError(const std::string& message, bool fatal, bool indexed, const std::string& filePath, uint lineNumber, uint columnNumber)
: message(message)
StorageError(Id id, const std::string& message, bool fatal, bool indexed, const std::string& filePath, uint lineNumber, uint columnNumber)
: id(id)
, message(message)
, fatal(fatal)
, indexed(indexed)
, filePath(filePath)
@@ -186,6 +188,7 @@ struct StorageError
, columnNumber(columnNumber)
{}
Id id;
std::string message;
bool fatal;
bool indexed;
+3 -1
View File
@@ -9,10 +9,12 @@
TaskFinishParsing::TaskFinishParsing(
PersistentStorage* storage,
StorageAccess* storageAccess,
std::shared_ptr<FileRegister> fileRegister,
DialogView* dialogView
)
: m_storage(storage)
, m_storageAccess(storageAccess)
, m_fileRegister(fileRegister)
, m_dialogView(dialogView)
{
@@ -59,7 +61,7 @@ Task::TaskState TaskFinishParsing::doUpdate(std::shared_ptr<Blackboard> blackboa
m_fileRegister->getParsedSourceFilesCount(),
m_fileRegister->getSourceFilesCount(),
time,
m_storage->getErrorCount()
m_storageAccess->getFilteredErrorCount()
);
return STATE_SUCCESS;
+3
View File
@@ -9,6 +9,7 @@
class DialogView;
class FileRegister;
class PersistentStorage;
class StorageAccess;
class TaskFinishParsing
: public Task
@@ -16,6 +17,7 @@ class TaskFinishParsing
public:
TaskFinishParsing(
PersistentStorage* storage,
StorageAccess* storageAccess,
std::shared_ptr<FileRegister> fileRegister,
DialogView* dialogView
);
@@ -29,6 +31,7 @@ private:
virtual void doReset(std::shared_ptr<Blackboard> blackboard);
PersistentStorage* m_storage;
StorageAccess* m_storageAccess;
std::shared_ptr<FileRegister> m_fileRegister;
DialogView* m_dialogView;
};
+9 -2
View File
@@ -15,6 +15,7 @@
#include "data/ErrorCountInfo.h"
#include "data/ErrorInfo.h"
#include "data/StorageStats.h"
#include "data/StorageTypes.h"
class Graph;
class TextAccess;
@@ -59,7 +60,6 @@ public:
virtual std::shared_ptr<TokenLocationFile> getTokenLocationsForLinesInFile(
const std::string& filePath, uint firstLineNumber, uint lastLineNumber) const = 0;
virtual std::shared_ptr<TokenLocationCollection> getErrorTokenLocations(std::vector<ErrorInfo>* errors) const = 0;
virtual std::shared_ptr<TokenLocationFile> getCommentLocationsInFile(const FilePath& filePath) const = 0;
virtual std::shared_ptr<TextAccess> getFileContent(const FilePath& filePath) const = 0;
@@ -67,8 +67,15 @@ public:
virtual FileInfo getFileInfoForFilePath(const FilePath& filePath) const = 0;
virtual std::vector<FileInfo> getFileInfosForFilePaths(const std::vector<FilePath>& filePaths) const = 0;
virtual ErrorCountInfo getErrorCount() const = 0;
virtual StorageStats getStorageStats() const = 0;
virtual ErrorCountInfo getErrorCount() const = 0;
virtual ErrorCountInfo getFilteredErrorCount() const = 0;
virtual std::vector<StorageError> getAllErrors() const = 0;
virtual std::vector<StorageError> getFilteredErrors() const = 0;
virtual std::shared_ptr<TokenLocationCollection> getErrorTokenLocations(std::vector<ErrorInfo>* errors) const = 0;
};
#endif // STORAGE_ACCESS_H
+103 -20
View File
@@ -6,6 +6,7 @@
#include "utility/logging/logging.h"
#include "utility/file/FileInfo.h"
#include "utility/messaging/type/MessageShowErrors.h"
#include "utility/TimePoint.h"
StorageAccessProxy::StorageAccessProxy()
@@ -218,16 +219,6 @@ std::shared_ptr<TokenLocationFile> StorageAccessProxy::getTokenLocationsForLines
return std::make_shared<TokenLocationFile>("");
}
std::shared_ptr<TokenLocationCollection> StorageAccessProxy::getErrorTokenLocations(std::vector<ErrorInfo>* errors) const
{
if (hasSubject())
{
return m_subject->getErrorTokenLocations(errors);
}
return std::make_shared<TokenLocationCollection>();
}
std::shared_ptr<TokenLocationFile> StorageAccessProxy::getCommentLocationsInFile(const FilePath& filePath) const
{
if (hasSubject())
@@ -268,16 +259,6 @@ std::vector<FileInfo> StorageAccessProxy::getFileInfosForFilePaths(const std::ve
return std::vector<FileInfo>();
}
ErrorCountInfo StorageAccessProxy::getErrorCount() const
{
if (hasSubject())
{
return m_subject->getErrorCount();
}
return ErrorCountInfo();
}
StorageStats StorageAccessProxy::getStorageStats() const
{
if (hasSubject())
@@ -287,3 +268,105 @@ StorageStats StorageAccessProxy::getStorageStats() const
return StorageStats();
}
ErrorCountInfo StorageAccessProxy::getErrorCount() const
{
ErrorCountInfo info;
std::vector<StorageError> storageErrors = getAllErrors();
for (const StorageError& error : storageErrors)
{
info.total++;
if (error.fatal)
{
info.fatal++;
}
}
return info;
}
ErrorCountInfo StorageAccessProxy::getFilteredErrorCount() const
{
ErrorCountInfo info;
std::vector<StorageError> storageErrors = getAllErrors();
for (const StorageError& error : storageErrors)
{
if (!m_errorFilter.filter(error))
{
continue;
}
info.total++;
if (error.fatal)
{
info.fatal++;
}
}
return info;
}
std::vector<StorageError> StorageAccessProxy::getAllErrors() const
{
if (hasSubject())
{
return m_subject->getAllErrors();
}
return std::vector<StorageError>();
}
std::vector<StorageError> StorageAccessProxy::getFilteredErrors() const
{
std::vector<StorageError> errors = getAllErrors();
std::vector<StorageError> filteredErrors;
for (const StorageError& error : errors)
{
if (m_errorFilter.filter(error))
{
filteredErrors.push_back(error);
}
}
return filteredErrors;
}
std::shared_ptr<TokenLocationCollection> StorageAccessProxy::getErrorTokenLocations(std::vector<ErrorInfo>* errors) const
{
if (hasSubject())
{
std::shared_ptr<TokenLocationCollection> collection = m_subject->getErrorTokenLocations(errors);
std::vector<ErrorInfo> unfilteredErrors = *errors;
errors->clear();
for (const ErrorInfo& error : unfilteredErrors)
{
if (m_errorFilter.filter(error))
{
errors->push_back(error);
}
else
{
// Set first bit to 1 to avoid collisions
Id locationId = ~(~size_t(0) >> 1) + error.id;
collection->removeTokenLocation(collection->findTokenLocationById(locationId));
}
}
return collection;
}
return std::make_shared<TokenLocationCollection>();
}
void StorageAccessProxy::handleMessage(MessageErrorFilterChanged* message)
{
m_errorFilter = message->errorFilter;
MessageShowErrors(getFilteredErrorCount()).dispatch();
}
+21 -3
View File
@@ -3,7 +3,15 @@
#include "data/access/StorageAccess.h"
class StorageAccessProxy: public StorageAccess
#include "data/ErrorFilter.h"
#include "data/StorageTypes.h"
#include "utility/messaging/MessageListener.h"
#include "utility/messaging/type/MessageErrorFilterChanged.h"
class StorageAccessProxy
: public StorageAccess
, public MessageListener<MessageErrorFilterChanged>
{
public:
StorageAccessProxy();
@@ -47,7 +55,6 @@ public:
const std::string& filePath, uint firstLineNumber, uint lastLineNumber
) const;
virtual std::shared_ptr<TokenLocationCollection> getErrorTokenLocations(std::vector<ErrorInfo>* errors) const;
virtual std::shared_ptr<TokenLocationFile> getCommentLocationsInFile(const FilePath& filePath) const;
virtual std::shared_ptr<TextAccess> getFileContent(const FilePath& filePath) const;
@@ -55,11 +62,22 @@ public:
virtual FileInfo getFileInfoForFilePath(const FilePath& filePath) const;
virtual std::vector<FileInfo> getFileInfosForFilePaths(const std::vector<FilePath>& filePaths) const;
virtual ErrorCountInfo getErrorCount() const;
virtual StorageStats getStorageStats() const;
virtual ErrorCountInfo getErrorCount() const;
virtual ErrorCountInfo getFilteredErrorCount() const;
virtual std::vector<StorageError> getAllErrors() const;
virtual std::vector<StorageError> getFilteredErrors() const;
virtual std::shared_ptr<TokenLocationCollection> getErrorTokenLocations(std::vector<ErrorInfo>* errors) const;
private:
void handleMessage(MessageErrorFilterChanged* message);
StorageAccess* m_subject;
ErrorFilter m_errorFilter;
};
#endif // STORAGE_ACCESS_PROXY_H
@@ -89,7 +89,7 @@ TokenLocation* TokenLocationCollection::addTokenLocation(
void TokenLocationCollection::removeTokenLocation(TokenLocation* location)
{
if (!findTokenLocationById(location->getId()))
if (!location || !findTokenLocationById(location->getId()))
{
LOG_ERROR("TokenLocation is not part of this TokenLocationCollection.");
return;
+1 -1
View File
@@ -57,7 +57,7 @@ Id ParserClientImpl::recordSymbol(
Id ParserClientImpl::recordSymbol(
const NameHierarchy& symbolName, SymbolKind symbolType,
const ParseLocation& location, const ParseLocation& scopeLocation,
const ParseLocation& location, const ParseLocation& scopeLocation,
AccessKind access, bool isImplicit
)
{
-10
View File
@@ -175,16 +175,6 @@ void ApplicationSettings::setIndexerThreadCount(const int count)
setValue<int>("indexing/indexer_thread_count", count);
}
bool ApplicationSettings::getShowExternalNonFatalErrors() const
{
return getValue<bool>("indexing/show_external_non_fatal_errors", false);
}
void ApplicationSettings::setShowExternalNonFatalErrors(const bool show)
{
setValue<bool>("indexing/show_external_non_fatal_errors", show);
}
std::string ApplicationSettings::getJavaPath() const
{
return getValue<std::string>("indexing/java/java_path", "");
-3
View File
@@ -54,9 +54,6 @@ public:
int getIndexerThreadCount() const;
void setIndexerThreadCount(const int count);
bool getShowExternalNonFatalErrors() const;
void setShowExternalNonFatalErrors(const bool show);
std::string getJavaPath() const;
void setJavaPath(const std::string path);
+4 -4
View File
@@ -192,10 +192,10 @@ bool FilePath::contains(const FilePath& other) const
boost::filesystem::path dir = m_path;
const boost::filesystem::path& dir2 = other.m_path;
if (dir.filename() == ".")
{
dir.remove_filename();
}
if (dir.filename() == ".")
{
dir.remove_filename();
}
auto it = dir.begin();
auto it2 = dir2.begin();
@@ -0,0 +1,24 @@
#ifndef MESSAGE_ERROR_FILTER_CHANGED_H
#define MESSAGE_ERROR_FILTER_CHANGED_H
#include "utility/messaging/Message.h"
#include "data/ErrorFilter.h"
class MessageErrorFilterChanged
: public Message<MessageErrorFilterChanged>
{
public:
MessageErrorFilterChanged(const ErrorFilter& filter)
: errorFilter(filter)
{
}
static const std::string getStaticType()
{
return "MessageErrorFilterChanged";
}
const ErrorFilter errorFilter;
};
#endif // MESSAGE_ERROR_FILTER_CHANGED_H
@@ -0,0 +1,31 @@
#ifndef MESSAGE_NEW_ERRORS_H
#define MESSAGE_NEW_ERRORS_H
#include "utility/messaging/Message.h"
#include "data/StorageTypes.h"
class MessageNewErrors
: public Message<MessageNewErrors>
{
public:
MessageNewErrors(const std::vector<StorageError>& errors)
: errors(errors)
{
setSendAsTask(false);
}
static const std::string getStaticType()
{
return "MessageNewErrors";
}
virtual void print(std::ostream& os) const
{
os << errors.size() << " errors";
}
const std::vector<StorageError> errors;
};
#endif // MESSAGE_NEW_ERRORS_H
@@ -10,6 +10,12 @@ class MessageShowErrors
public:
MessageShowErrors(ErrorCountInfo errorCount)
: errorCount(errorCount)
, errorId(0)
{
}
MessageShowErrors(Id errorId)
: errorId(errorId)
{
}
@@ -19,6 +25,7 @@ public:
}
ErrorCountInfo errorCount;
Id errorId;
};
#endif // MESSAGE_SHOW_ERRORS_H
+8
View File
@@ -36,6 +36,8 @@ add_files(
qt/element/QtSmartSearchBox.h
qt/element/QtStatusBar.cpp
qt/element/QtStatusBar.h
qt/element/QtTable.cpp
qt/element/QtTable.h
qt/element/QtUndoRedo.cpp
qt/element/QtUndoRedo.h
@@ -95,10 +97,14 @@ add_files(
qt/view/QtCompositeView.h
qt/view/QtDialogView.cpp
qt/view/QtDialogView.h
qt/view/QtErrorView.cpp
qt/view/QtErrorView.h
qt/view/QtGraphView.cpp
qt/view/QtGraphView.h
qt/view/QtGraphViewStyleImpl.cpp
qt/view/QtGraphViewStyleImpl.h
qt/view/QtLogView.cpp
qt/view/QtLogView.h
qt/view/QtMainView.cpp
qt/view/QtMainView.h
qt/view/QtRefreshView.cpp
@@ -107,6 +113,8 @@ add_files(
qt/view/QtSearchView.h
qt/view/QtStatusBarView.cpp
qt/view/QtStatusBarView.h
qt/view/QtTabbedView.cpp
qt/view/QtTabbedView.h
qt/view/QtUndoRedoView.cpp
qt/view/QtUndoRedoView.h
qt/view/QtViewFactory.cpp
@@ -32,8 +32,6 @@ void setupApp(int argc, char *argv[])
dataDir.mkpath(userDataPath);
}
std::cout << "apppath: " << AppPath::getAppPath() << std::endl;
utility::copyNewFilesFromDirectory(QString::fromStdString(AppPath::getAppPath() + "/usr/" ), userDataPath);
}
@@ -419,6 +419,12 @@ void QtCodeNavigator::scrollToLine(const FilePath& filePath, unsigned int line)
{
emit shouldScrollToSnippet(file->getFileSnippet(), line);
}
else
{
m_scrollToFile = file;
m_scrollToLine = line;
scrollToSnippetIfRequested();
}
}
void QtCodeNavigator::scrollToLocation(QtCodeFile* file, Id locationId, bool scrollTo)
+62
View File
@@ -0,0 +1,62 @@
#include "qt/element/QtTable.h"
#include <QResizeEvent>
QtTable::QtTable(QWidget* parent)
: QTableView(parent)
, m_rowsToFill(0)
{
}
QtTable::~QtTable()
{
}
void QtTable::resizeEvent(QResizeEvent* event)
{
QTableView::resizeEvent(event);
int tableHeight = event->size().height();
if (this->model()->rowCount() == 0)
{
this->model()->insertRow(0);
}
m_rowsToFill = (float)tableHeight / this->rowHeight(0);
updateRows();
}
void QtTable::updateRows()
{
while (model()->rowCount() <= m_rowsToFill)
{
model()->insertRow(model()->rowCount());
}
while (model()->rowCount() > m_rowsToFill + 1)
{
int row = model()->rowCount() - 1;
if (model()->index(row, 0).data(Qt::DisplayRole).toString().isEmpty())
{
model()->removeRow(row);
}
else
{
break;
}
}
}
int QtTable::getFilledRowCount()
{
for (int i = 0; i < model()->rowCount(); i++)
{
if (model()->index(i, 0).data(Qt::DisplayRole).toString().isEmpty())
{
return i;
}
}
return model()->rowCount();
}
+24
View File
@@ -0,0 +1,24 @@
#ifndef QT_TABLE_H
#define QT_TABLE_H
#include <QTableView>
class QtTable
: public QTableView
{
Q_OBJECT
public:
QtTable(QWidget* parent = nullptr);
virtual ~QtTable();
void updateRows();
int getFilledRowCount();
protected:
virtual void resizeEvent(QResizeEvent* event);
private:
float m_rowsToFill;
};
#endif // QT_TABLE_H
+4
View File
@@ -92,6 +92,10 @@ namespace utility
{
val = std::to_string(ApplicationSettings::getInstance()->getFontSize() + 2);
}
else if (val == "font_size+5")
{
val = std::to_string(ApplicationSettings::getInstance()->getFontSize() + 5);
}
else if (val == "font_size-2")
{
val = std::to_string(ApplicationSettings::getInstance()->getFontSize() - 2);
+5
View File
@@ -61,6 +61,11 @@ void QtCodeView::setErrorInfos(const std::vector<ErrorInfo>& errorInfos)
m_errorInfos = errorInfos;
}
bool QtCodeView::showsErrors() const
{
return m_errorInfos.size() > 0;
}
void QtCodeView::showCodeSnippets(const std::vector<CodeSnippetParams>& snippets, const std::vector<Id>& activeTokenIds)
{
m_showCodeSnippetsFunctor(snippets, activeTokenIds);
+1
View File
@@ -29,6 +29,7 @@ public:
virtual void clear();
virtual void setErrorInfos(const std::vector<ErrorInfo>& errorInfos);
virtual bool showsErrors() const;
virtual void showCodeSnippets(const std::vector<CodeSnippetParams>& snippets, const std::vector<Id>& activeTokenIds);
virtual void addCodeSnippets(const std::vector<CodeSnippetParams>& snippets, bool insert);
+248
View File
@@ -0,0 +1,248 @@
#include "qt/view/QtErrorView.h"
#include <QBoxLayout>
#include <QCheckBox>
#include <QFrame>
#include <QHeaderView>
#include <QItemSelectionModel>
#include <QPalette>
#include <QStandardItemModel>
#include <QStandardItem>
#include "qt/utility/utilityQt.h"
#include "qt/element/QtTable.h"
#include "settings/ApplicationSettings.h"
#include "settings/ColorScheme.h"
#include "utility/messaging/type/MessageErrorFilterChanged.h"
#include "utility/messaging/type/MessageShowErrors.h"
#include "utility/ResourcePaths.h"
#include "qt/view/QtViewWidgetWrapper.h"
QtErrorView::QtErrorView(ViewLayout* viewLayout)
: ErrorView(viewLayout)
, m_clearFunctor(std::bind(&QtErrorView::doClear, this))
, m_refreshFunctor(std::bind(&QtErrorView::doRefreshView, this))
, m_addErrorFunctor(std::bind(&QtErrorView::doAddError, this, std::placeholders::_1))
{
}
QtErrorView::~QtErrorView()
{
}
void QtErrorView::createWidgetWrapper()
{
setWidgetWrapper(std::make_shared<QtViewWidgetWrapper>(new QFrame()));
}
void QtErrorView::initView()
{
QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this);
QBoxLayout* layout = new QVBoxLayout();
layout->setContentsMargins(0, 0, 0, 5);
layout->setSpacing(0);
widget->setLayout(layout);
m_table = new QtTable(this);
m_table->setAlternatingRowColors(true);
m_table->setShowGrid(false);
m_table->verticalHeader()->setAlternatingRowColors(true);
m_table->verticalHeader()->sectionResizeMode(QHeaderView::Fixed);
m_table->verticalHeader()->setDefaultSectionSize(ApplicationSettings::getInstance()->getFontSize() + 6);
m_table->horizontalHeader()->setStretchLastSection(true);
m_table->setSelectionBehavior(QAbstractItemView::SelectRows);
m_table->setSelectionMode(QAbstractItemView::SingleSelection);
m_model = new QStandardItemModel(this);
m_table->setModel(m_model);
// Setup Table Headers
m_model->setColumnCount(5);
m_table->setColumnWidth(COLUMN::TYPE, 70);
m_table->setColumnWidth(COLUMN::MESSAGE, 450);
m_table->setColumnWidth(COLUMN::FILE, 300);
m_table->setColumnWidth(COLUMN::LINE, 50);
m_table->setColumnHidden(COLUMN::ID, true);
QStringList headers;
headers << "Type" << "Message" << "File" << "Line" << "Indexed";
m_model->setHorizontalHeaderLabels(headers);
m_table->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
connect(m_table->selectionModel(), &QItemSelectionModel::currentRowChanged,
[=](const QModelIndex& index, const QModelIndex& previousIndex)
{
if (index.isValid())
{
if (m_model->item(index.row(), COLUMN::FILE) == nullptr)
{
return;
}
MessageShowErrors(m_model->item(index.row(), COLUMN::ID)->text().toUInt()).dispatch();
}
});
layout->addWidget(m_table);
// Setup Checkboxes
QBoxLayout* checkboxes = new QHBoxLayout();
checkboxes->addSpacing(15);
m_showFatals = createFilterCheckbox("fatals", true, checkboxes);
m_showErrors = createFilterCheckbox("errors", true, checkboxes);
m_showNonIndexedFatals = createFilterCheckbox("fatals in non-indexed files", true, checkboxes);
m_showNonIndexedErrors = createFilterCheckbox("errors in non-indexed files", false, checkboxes);
checkboxes->addStretch();
layout->addLayout(checkboxes);
doRefreshView();
}
void QtErrorView::refreshView()
{
m_refreshFunctor();
}
void QtErrorView::clear()
{
m_clearFunctor();
}
void QtErrorView::addError(const StorageError& error)
{
m_addErrorFunctor(error);
}
void QtErrorView::clickedInEmptySpace()
{
}
void QtErrorView::doRefreshView()
{
m_model->removeRows(0, m_model->rowCount());
for (StorageError error : m_errors)
{
addErrorToTable(error);
}
m_table->updateRows();
setStyleSheet();
}
void QtErrorView::doClear()
{
m_model->removeRows(0, m_model->rowCount());
m_errors.clear();
}
void QtErrorView::doAddError(const StorageError& error)
{
m_errors.push_back(error);
addErrorToTable(error);
}
void QtErrorView::setStyleSheet() const
{
QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this);
utility::setWidgetBackgroundColor(widget, ColorScheme::getInstance()->getColor("error/background"));
QPalette palette( m_showErrors->palette() );
palette.setColor(QPalette::WindowText, QColor(ColorScheme::getInstance()->getColor("error/text/normal").c_str()));
//palette.setColor(QPalette::Text, QColor(ColorScheme::getInstance()->getColor("error/text/normal").c_str()));
//palette.setColor(QPalette::ButtonText, QColor(ColorScheme::getInstance()->getColor("error/text/normal").c_str()));
//m_showErrors->setAutoFillBackground(true);
m_showErrors->setPalette(palette);
m_showFatals->setPalette(palette);
m_showNonIndexedErrors->setPalette(palette);
m_showNonIndexedFatals->setPalette(palette);
widget->setStyleSheet(
utility::getStyleSheet(ResourcePaths::getGuiPath() + "error_view/error_view.css").c_str()
);
}
void QtErrorView::addErrorToTable(const StorageError& error)
{
if (!isShownError(error))
{
return;
}
int rowNumber = m_table->getFilledRowCount();
if (rowNumber < m_model->rowCount())
{
m_model->insertRow(rowNumber);
}
m_model->setItem(rowNumber, COLUMN::TYPE, new QStandardItem(error.fatal ? "FATAL" : "ERROR"));
m_model->item(rowNumber, COLUMN::TYPE)->setForeground(QBrush(Qt::red));
m_model->item(rowNumber, COLUMN::TYPE)->setTextAlignment(Qt::AlignCenter);
m_model->setItem(rowNumber, COLUMN::MESSAGE, new QStandardItem(error.message.c_str()));
std::string errorPngPath = ResourcePaths::getGuiPath() + "/indexing_dialog/error.png";
m_model->item(rowNumber, COLUMN::MESSAGE)->setIcon(QIcon(QString(errorPngPath.c_str())));
m_model->setItem(rowNumber, COLUMN::FILE, new QStandardItem(error.filePath.c_str()));
m_model->item(rowNumber, COLUMN::FILE)->setToolTip(error.filePath.c_str());
m_model->setItem(rowNumber, COLUMN::LINE, new QStandardItem(QString::number(error.lineNumber)));
m_model->setItem(rowNumber, COLUMN::INDEXED, new QStandardItem(error.indexed ? "yes" : "no"));
m_model->setItem(rowNumber, COLUMN::ID, new QStandardItem(QString::number(error.id)));
m_table->updateRows();
}
QCheckBox* QtErrorView::createFilterCheckbox(const QString& name, bool checked, QBoxLayout* layout)
{
QCheckBox* checkbox = new QCheckBox(name);
checkbox->setChecked(checked);
connect(checkbox, &QCheckBox::stateChanged,
[=](int)
{
m_table->selectionModel()->clearSelection();
ErrorFilter filter;
filter.error = m_showErrors->checkState() == Qt::Checked;
filter.fatal = m_showFatals->checkState() == Qt::Checked;
filter.unindexedError = m_showNonIndexedErrors->checkState() == Qt::Checked;
filter.unindexedFatal = m_showNonIndexedFatals->checkState() == Qt::Checked;
MessageErrorFilterChanged(filter).dispatch();
}
);
layout->addWidget(checkbox);
layout->addSpacing(25);
return checkbox;
}
bool QtErrorView::isShownError(const StorageError& error)
{
if (!error.fatal && error.indexed && m_showErrors->checkState() == Qt::Checked)
{
return true;
}
if (error.fatal && error.indexed && m_showFatals->checkState() == Qt::Checked)
{
return true;
}
if (error.fatal && !error.indexed && m_showNonIndexedErrors->checkState() == Qt::Checked)
{
return true;
}
if (error.fatal && !error.indexed && m_showNonIndexedFatals->checkState() == Qt::Checked)
{
return true;
}
return false;
}
+74
View File
@@ -0,0 +1,74 @@
#ifndef QT_ERROR_VIEW_H
#define QT_ERROR_VIEW_H
#include <QWidget>
#include "component/view/ErrorView.h"
#include "qt/utility/QtThreadedFunctor.h"
class QBoxLayout;
class QCheckBox;
class QPalette;
class QStandardItemModel;
class QtTable;
class QtErrorView
: public QWidget
, public ErrorView
{
Q_OBJECT
public:
QtErrorView(ViewLayout* viewLayout);
virtual ~QtErrorView();
// View implementation
virtual void createWidgetWrapper();
virtual void initView();
virtual void refreshView();
// ErrorView implementation
virtual void clear();
virtual void addError(const StorageError& error);
private slots:
void clickedInEmptySpace();
private:
enum COLUMN {
TYPE = 0,
MESSAGE = 1,
FILE = 2,
LINE = 3,
INDEXED = 4,
ID = 5
};
void doRefreshView();
void doClear();
void doAddError(const StorageError& error);
void setStyleSheet() const;
void addErrorToTable(const StorageError& error);
QCheckBox* createFilterCheckbox(const QString& name, bool checked, QBoxLayout* layout);
bool isShownError(const StorageError& error);
QtThreadedFunctor<void> m_clearFunctor;
QtThreadedFunctor<void> m_refreshFunctor;
QtThreadedFunctor<const StorageError&> m_addErrorFunctor;
QCheckBox* m_showErrors;
QCheckBox* m_showFatals;
QCheckBox* m_showNonIndexedErrors;
QCheckBox* m_showNonIndexedFatals;
QStandardItemModel* m_model;
QtTable* m_table;
std::vector<StorageError> m_errors;
QPalette* m_palette;
};
#endif // QT_ERROR_VIEW_H
+57
View File
@@ -0,0 +1,57 @@
#include "qt/view/QtLogView.h"
#include <QBoxLayout>
#include <QFrame>
#include <QLabel>
#include "qt/view/QtViewWidgetWrapper.h"
QtLogView::QtLogView(ViewLayout* viewLayout)
: LogView(viewLayout)
, m_clearFunctor(std::bind(&QtLogView::doClear, this))
, m_refreshFunctor(std::bind(&QtLogView::doRefreshView, this))
{
}
QtLogView::~QtLogView()
{
}
void QtLogView::createWidgetWrapper()
{
setWidgetWrapper(std::make_shared<QtViewWidgetWrapper>(new QFrame()));
}
void QtLogView::initView()
{
QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this);
QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
widget->setLayout(layout);
QLabel* label = new QLabel("test log view");
widget->layout()->addWidget(label);
doRefreshView();
}
void QtLogView::refreshView()
{
m_refreshFunctor();
}
void QtLogView::clear()
{
m_clearFunctor();
}
void QtLogView::doClear()
{
}
void QtLogView::doRefreshView()
{
}
+29
View File
@@ -0,0 +1,29 @@
#ifndef QT_LOG_VIEW_H
#define QT_LOG_VIEW_H
#include "component/view/LogView.h"
#include "qt/utility/QtThreadedFunctor.h"
class QtLogView
: public LogView
{
public:
QtLogView(ViewLayout* viewLayout);
virtual ~QtLogView();
// View implementation
virtual void createWidgetWrapper();
virtual void initView();
virtual void refreshView();
virtual void clear();
private:
void doClear();
void doRefreshView();
QtThreadedFunctor<void> m_clearFunctor;
QtThreadedFunctor<void> m_refreshFunctor;
};
#endif // QT_LOG_VIEW_H
+12 -2
View File
@@ -45,12 +45,22 @@ void QtMainView::removeView(View* view)
void QtMainView::showView(View* view)
{
m_window->showView(view);
m_onQtThread(
[=]()
{
m_window->showView(view);
}
);
}
void QtMainView::hideView(View* view)
{
m_window->hideView(view);
m_onQtThread(
[=]()
{
m_window->hideView(view);
}
);
}
void QtMainView::loadLayout()
+5 -3
View File
@@ -38,13 +38,13 @@ public:
virtual void showView(View* view);
virtual void hideView(View* view);
virtual void loadLayout();
virtual void saveLayout();
virtual QStatusBar* getStatusBar();
virtual void setStatusBar(QStatusBar* statusBar);
// MainView implementation
virtual void loadLayout();
virtual void saveLayout();
virtual void hideStartScreen();
virtual void setTitle(const std::string& title);
virtual void activateWindow();
@@ -76,6 +76,8 @@ private:
QtThreadedFunctor<> m_activateWindowFunctor;
QtThreadedFunctor<> m_updateRecentProjectMenuFunctor;
QtThreadedFunctor<bool> m_forceLicenseScreenFunctor;
QtThreadedLambdaFunctor m_onQtThread;
};
#endif // QT_MAIN_VIEW_H
+66
View File
@@ -0,0 +1,66 @@
#include "qt/view/QtTabbedView.h"
#include <QBoxLayout>
#include <QFrame>
#include <QTabBar>
#include <QTabWidget>
#include "qt/utility/utilityQt.h"
#include "qt/view/QtViewWidgetWrapper.h"
#include "settings/ColorScheme.h"
#include "utility/ResourcePaths.h"
QtTabbedView::QtTabbedView(ViewLayout* viewLayout, const std::string& name)
: TabbedView(viewLayout, name)
, m_refreshFunctor(std::bind(&QtTabbedView::doRefreshView, this))
{
}
QtTabbedView::~QtTabbedView()
{
}
void QtTabbedView::createWidgetWrapper()
{
setWidgetWrapper(std::make_shared<QtViewWidgetWrapper>(new QFrame()));
}
void QtTabbedView::initView()
{
QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this);
QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
widget->setLayout(layout);
m_widget = new QTabWidget(widget);
layout->addWidget(m_widget);
}
void QtTabbedView::refreshView()
{
m_refreshFunctor();
}
void QtTabbedView::doRefreshView()
{
setStyleSheet();
}
void QtTabbedView::addViewWidget(View* view)
{
m_widget->addTab(QtViewWidgetWrapper::getWidgetOfView(view), view->getName().c_str());
doRefreshView();
}
void QtTabbedView::setStyleSheet()
{
utility::setWidgetBackgroundColor(QtViewWidgetWrapper::getWidgetOfView(this), ColorScheme::getInstance()->getColor("tab/background"));
m_widget->setStyleSheet(
utility::getStyleSheet(ResourcePaths::getGuiPath() + "tabbed_view/tabbed_view.css").c_str()
);
}
+32
View File
@@ -0,0 +1,32 @@
#ifndef QT_TABBED_VIEW
#define QT_TABBED_VIEW
#include "component/view/TabbedView.h"
#include "qt/utility/QtThreadedFunctor.h"
class QTabWidget;
class QtTabbedView
: public TabbedView
{
public:
QtTabbedView(ViewLayout* viewLayout, const std::string& name);
~QtTabbedView();
// View implementation
virtual void createWidgetWrapper();
virtual void initView();
virtual void refreshView();
// TabbedView implementation
virtual void addViewWidget(View* view);
private:
void setStyleSheet();
void doRefreshView();
QtThreadedFunctor<void> m_refreshFunctor;
QTabWidget* m_widget;
};
#endif // QT_TABBED_VIEW
+21
View File
@@ -4,12 +4,15 @@
#include "qt/view/QtCodeView.h"
#include "qt/view/QtCompositeView.h"
#include "qt/view/QtDialogView.h"
#include "qt/view/QtErrorView.h"
#include "qt/view/QtGraphView.h"
#include "qt/view/QtGraphViewStyleImpl.h"
#include "qt/view/QtLogView.h"
#include "qt/view/QtMainView.h"
#include "qt/view/QtRefreshView.h"
#include "qt/view/QtSearchView.h"
#include "qt/view/QtStatusBarView.h"
#include "qt/view/QtTabbedView.h"
#include "qt/view/QtUndoRedoView.h"
QtViewFactory::QtViewFactory()
@@ -34,11 +37,29 @@ std::shared_ptr<CompositeView> QtViewFactory::createCompositeView(
return ptr;
}
std::shared_ptr<TabbedView> QtViewFactory::createTabbedView(ViewLayout* viewLayout, const std::string& name) const
{
std::shared_ptr<TabbedView> ptr = std::make_shared<QtTabbedView>(viewLayout, name);
ptr->init();
ptr->addToLayout();
return ptr;
}
std::shared_ptr<CodeView> QtViewFactory::createCodeView(ViewLayout* viewLayout) const
{
return View::createInitAndAddToLayout<QtCodeView>(viewLayout);
}
std::shared_ptr<ErrorView> QtViewFactory::createErrorView(ViewLayout* viewLayout) const
{
return View::createInitAndAddToLayout<QtErrorView>(viewLayout);
}
std::shared_ptr<LogView> QtViewFactory::createLogView(ViewLayout* viewLayout) const
{
return View::createInitAndAddToLayout<QtLogView>(viewLayout);
}
std::shared_ptr<GraphView> QtViewFactory::createGraphView(ViewLayout* viewLayout) const
{
GraphViewStyle::setImpl(std::make_shared<QtGraphViewStyleImpl>());
+3
View File
@@ -12,9 +12,12 @@ public:
virtual std::shared_ptr<MainView> createMainView() const;
virtual std::shared_ptr<CompositeView> createCompositeView(
ViewLayout* viewLayout, CompositeView::CompositeDirection direction, const std::string& name) const;
virtual std::shared_ptr<TabbedView> createTabbedView(ViewLayout* viewLayout, const std::string& name) const;
virtual std::shared_ptr<CodeView> createCodeView(ViewLayout* viewLayout) const;
virtual std::shared_ptr<ErrorView> createErrorView(ViewLayout* viewLayout) const;
virtual std::shared_ptr<GraphView> createGraphView(ViewLayout* viewLayout) const;
virtual std::shared_ptr<LogView> createLogView(ViewLayout* viewLayout) const;
virtual std::shared_ptr<RefreshView> createRefreshView(ViewLayout* viewLayout) const;
virtual std::shared_ptr<SearchView> createSearchView(ViewLayout* viewLayout) const;
virtual std::shared_ptr<StatusBarView> createStatusBarView(ViewLayout* viewLayout) const;
+13
View File
@@ -13,6 +13,7 @@
#include "Application.h"
#include "component/view/View.h"
#include "component/view/CompositeView.h"
#include "component/view/TabbedView.h"
#include "LicenseChecker.h"
#include "qt/utility/QtContextMenu.h"
#include "qt/utility/utilityQt.h"
@@ -721,6 +722,18 @@ QtMainWindow::DockWidget* QtMainWindow::getDockWidgetForView(View* view)
}
}
}
const TabbedView* tabbedView = dynamic_cast<const TabbedView*>(dock.view);
if (tabbedView)
{
for (const View* v : tabbedView->getViews())
{
if (v == view)
{
return &dock;
}
}
}
}
LOG_ERROR("DockWidget was not found for view.");
+1
View File
@@ -78,6 +78,7 @@ QtStartScreen::QtStartScreen(QWidget *parent)
: QtWindow(parent)
{
this->raise();
setWindowModality(Qt::ApplicationModal);
}
QSize QtStartScreen::sizeHint() const
@@ -131,20 +131,6 @@ void QtProjectWizzardContentPreferences::populate(QGridLayout* layout, int& row)
row++;
// ignore non-fatal errors in non-indexed files
m_fatalErrors = new QCheckBox("Display non-fatal errors in unindexed files", this);
layout->addWidget(createFormLabel("Non-Fatal Errors"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
layout->addWidget(m_fatalErrors, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
addHelpButton(
"When checked non-fatal errors within included unindexed files are also shown."
, layout, row
);
layout->setRowMinimumHeight(row, 30);
row++;
layout->setRowMinimumHeight(row++, 20);
@@ -268,7 +254,6 @@ void QtProjectWizzardContentPreferences::load()
m_pluginPort->setText(QString::number(appSettings->getPluginPort()));
m_threads->setCurrentIndex(appSettings->getIndexerThreadCount() - 1);
m_fatalErrors->setChecked(appSettings->getShowExternalNonFatalErrors());
if (m_javaPath)
{
@@ -302,7 +287,6 @@ void QtProjectWizzardContentPreferences::save()
if (pluginPort) appSettings->setPluginPort(pluginPort);
appSettings->setIndexerThreadCount(m_threads->currentIndex() + 1);
appSettings->setShowExternalNonFatalErrors(m_fatalErrors->isChecked());
if (m_javaPath)
{
@@ -48,7 +48,6 @@ private:
QLineEdit* m_pluginPort;
QComboBox* m_threads;
QCheckBox* m_fatalErrors;
std::shared_ptr<CombinedPathDetector> m_javaPathDetector;
QComboBox* m_javaPathDetectorBox;