ui: Added show errors button to title bar of incomplete files (issue #246)
* Shows all errors within the file and all included files.
This commit is contained in:
@@ -14,6 +14,13 @@
|
||||
<line>#A0A0A0</line>
|
||||
<icon_type>white</icon_type> <!-- white, grey, black -->
|
||||
</dock>
|
||||
<button>
|
||||
<text>white</text>
|
||||
<background>#CC494949</background>
|
||||
<border>#D4D4D4</border>
|
||||
<border_hover>white</border_hover>
|
||||
<icon>white</icon>
|
||||
</button>
|
||||
</window>
|
||||
|
||||
<search>
|
||||
|
||||
@@ -14,6 +14,13 @@
|
||||
<line>#BEBEBE</line>
|
||||
<icon_type>grey</icon_type> <!-- white, grey, black -->
|
||||
</dock>
|
||||
<button>
|
||||
<text>black</text>
|
||||
<background>white</background>
|
||||
<border>#AAA</border>
|
||||
<border_hover>#878787</border_hover>
|
||||
<icon>black</icon>
|
||||
</button>
|
||||
</window>
|
||||
|
||||
<search>
|
||||
|
||||
@@ -14,6 +14,13 @@
|
||||
<line>#808080</line>
|
||||
<icon_type>white</icon_type> <!-- white, grey, black -->
|
||||
</dock>
|
||||
<button>
|
||||
<text>white</text>
|
||||
<background>#3A3A3A</background>
|
||||
<border>#C5C5C5</border>
|
||||
<border_hover>white</border_hover>
|
||||
<icon>white</icon>
|
||||
</button>
|
||||
</window>
|
||||
|
||||
<search>
|
||||
|
||||
@@ -110,6 +110,10 @@
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
#title_bar #screen_button, #title_bar_single #screen_button {
|
||||
margin-right: 7px;
|
||||
}
|
||||
|
||||
#title_button {
|
||||
background-color: <color:code/file/title/normal>;
|
||||
border: none;
|
||||
|
||||
@@ -41,3 +41,17 @@ QDockWidget::close-button {
|
||||
QDockWidget::float-button {
|
||||
margin-right: <platform_wml:0|2|0>px;
|
||||
}
|
||||
|
||||
#screen_button {
|
||||
background-color: <color:window/button/background>;
|
||||
border: 1px solid <color:window/button/border>;
|
||||
border-radius: 5px;
|
||||
color: <color:window/button/text>;
|
||||
font-size: <setting:font_size>px;
|
||||
padding: 4px 6px;
|
||||
margin: 2px 0px;
|
||||
}
|
||||
|
||||
#screen_button:hover {
|
||||
border: 1px solid <color:window/button/border_hover>;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ int main() {
|
||||
TicTacToe tictactoe;
|
||||
|
||||
while ( tictactoe.Start() ) {
|
||||
tictactoe.Run();
|
||||
tictactoe.Ru();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -18,7 +18,7 @@ bool TicTacToe::Start() {
|
||||
Reset();
|
||||
io::stringOut("Tic Tac Toe\n\n[1] Human\n[2] Computer\n[3] Quit\n\n");
|
||||
|
||||
players_[0] = SelectPlayer( Field::PlayerA, "Player A" );
|
||||
player_[0] = SelectPlayer( Field::PlayerA, "Player A" );
|
||||
if ( !players_[0] ) {
|
||||
return false;
|
||||
}
|
||||
@@ -66,7 +66,7 @@ void TicTacToe::Reset() {
|
||||
}
|
||||
}
|
||||
|
||||
Player* TicTacToe::SelectPlayer( Field::Token token, const char* name ) const {
|
||||
Player* TicTacToe::SlectPlayer( Field::Token token, const char* name ) const {
|
||||
int selection = 0;
|
||||
|
||||
while ( true ) {
|
||||
@@ -77,7 +77,7 @@ Player* TicTacToe::SelectPlayer( Field::Token token, const char* name ) const {
|
||||
selection = io::numberIn();
|
||||
|
||||
switch ( selection ) {
|
||||
case 1 : return new HumanPlayer( token, name );
|
||||
case 1 : return new HuanPlayer( token, name );
|
||||
case 2 : return new ArtificialPlayer( token, name );
|
||||
case 3 : return 0;
|
||||
default : io::stringOut("Wrong input!\n");
|
||||
|
||||
@@ -26,5 +26,5 @@
|
||||
<type>C++ Source Group</type>
|
||||
</source_group_afdfade2-4b42-49a6-961a-d4a563f2cf84>
|
||||
</source_groups>
|
||||
<version>4</version>
|
||||
<version>5</version>
|
||||
</config>
|
||||
|
||||
@@ -446,6 +446,7 @@ add_files(
|
||||
utility/messaging/type/MessageSearchFullText.h
|
||||
utility/messaging/type/MessageShowErrorHelpMessage.h
|
||||
utility/messaging/type/MessageShowErrors.h
|
||||
utility/messaging/type/MessageShowErrorsForFile.h
|
||||
utility/messaging/type/MessageShowReference.h
|
||||
utility/messaging/type/MessageShowScope.h
|
||||
utility/messaging/type/MessageShowStatus.h
|
||||
|
||||
@@ -90,38 +90,6 @@ void ActivationController::handleMessage(MessageActivateNodes* message)
|
||||
m.dispatchImmediately();
|
||||
}
|
||||
|
||||
void ActivationController::handleMessage(MessageSearch* message)
|
||||
{
|
||||
const std::vector<SearchMatch>& matches = message->getMatches();
|
||||
|
||||
if (matches.size() && matches.back().searchType == SearchMatch::SEARCH_COMMAND)
|
||||
{
|
||||
switch (matches.back().getCommandType())
|
||||
{
|
||||
case SearchMatch::COMMAND_ALL:
|
||||
case SearchMatch::COMMAND_NODE_FILTER:
|
||||
{
|
||||
MessageActivateAll(message->acceptedNodeTypes).dispatchImmediately();
|
||||
return;
|
||||
}
|
||||
|
||||
case SearchMatch::COMMAND_ERROR:
|
||||
{
|
||||
MessageShowErrors(m_storageAccess->getErrorCount()).dispatch();
|
||||
MessageFlushUpdates().dispatch();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MessageActivateTokens m(message);
|
||||
m.tokenIds = message->getTokenIdsOfMatches();
|
||||
m.searchMatches = matches;
|
||||
m.tokenNames = m_storageAccess->getNameHierarchiesForNodeIds(m.tokenIds);
|
||||
m.isFromSearch = message->isFromSearch;
|
||||
m.dispatchImmediately();
|
||||
}
|
||||
|
||||
void ActivationController::handleMessage(MessageActivateTokenIds* message)
|
||||
{
|
||||
MessageActivateTokens m(message);
|
||||
@@ -154,10 +122,47 @@ void ActivationController::handleMessage(MessageResetZoom* message)
|
||||
MessageRefresh().refreshUiOnly().dispatch();
|
||||
}
|
||||
|
||||
|
||||
|
||||
MessageStatus(L"Font size: " + std::to_wstring(fontSizeStd)).dispatch();
|
||||
}
|
||||
|
||||
void ActivationController::handleMessage(MessageSearch* message)
|
||||
{
|
||||
const std::vector<SearchMatch>& matches = message->getMatches();
|
||||
|
||||
if (matches.size() && matches.back().searchType == SearchMatch::SEARCH_COMMAND)
|
||||
{
|
||||
switch (matches.back().getCommandType())
|
||||
{
|
||||
case SearchMatch::COMMAND_ALL:
|
||||
case SearchMatch::COMMAND_NODE_FILTER:
|
||||
{
|
||||
MessageActivateAll(message->acceptedNodeTypes).dispatchImmediately();
|
||||
return;
|
||||
}
|
||||
|
||||
case SearchMatch::COMMAND_ERROR:
|
||||
{
|
||||
MessageShowErrors(m_storageAccess->getErrorCount()).dispatch();
|
||||
MessageFlushUpdates().dispatch();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MessageActivateTokens m(message);
|
||||
m.tokenIds = message->getTokenIdsOfMatches();
|
||||
m.searchMatches = matches;
|
||||
m.tokenNames = m_storageAccess->getNameHierarchiesForNodeIds(m.tokenIds);
|
||||
m.isFromSearch = message->isFromSearch;
|
||||
m.dispatchImmediately();
|
||||
}
|
||||
|
||||
void ActivationController::handleMessage(MessageShowErrorsForFile* message)
|
||||
{
|
||||
MessageShowErrors(m_storageAccess->getErrorsForFileLimited(message->filePath)).dispatch();
|
||||
}
|
||||
|
||||
void ActivationController::handleMessage(MessageZoom* message)
|
||||
{
|
||||
bool zoomIn = message->zoomIn;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "utility/messaging/type/MessageActivateSourceLocations.h"
|
||||
#include "utility/messaging/type/MessageResetZoom.h"
|
||||
#include "utility/messaging/type/MessageSearch.h"
|
||||
#include "utility/messaging/type/MessageShowErrorsForFile.h"
|
||||
#include "utility/messaging/type/MessageZoom.h"
|
||||
|
||||
class StorageAccess;
|
||||
@@ -26,6 +27,7 @@ class ActivationController
|
||||
, public MessageListener<MessageActivateSourceLocations>
|
||||
, public MessageListener<MessageResetZoom>
|
||||
, public MessageListener<MessageSearch>
|
||||
, public MessageListener<MessageShowErrorsForFile>
|
||||
, public MessageListener<MessageZoom>
|
||||
{
|
||||
public:
|
||||
@@ -38,10 +40,11 @@ private:
|
||||
virtual void handleMessage(MessageActivateEdge* message);
|
||||
virtual void handleMessage(MessageActivateFile* message);
|
||||
virtual void handleMessage(MessageActivateNodes* message);
|
||||
virtual void handleMessage(MessageSearch* message);
|
||||
virtual void handleMessage(MessageActivateTokenIds* message);
|
||||
virtual void handleMessage(MessageActivateSourceLocations* message);
|
||||
virtual void handleMessage(MessageResetZoom* message);
|
||||
virtual void handleMessage(MessageSearch* message);
|
||||
virtual void handleMessage(MessageShowErrorsForFile* message);
|
||||
virtual void handleMessage(MessageZoom* message);
|
||||
|
||||
StorageAccess* m_storageAccess;
|
||||
|
||||
@@ -307,8 +307,13 @@ void CodeController::handleMessage(MessageShowErrors* message)
|
||||
CodeView::ScrollParams scrollParams(CodeView::ScrollParams::SCROLL_TO_DEFINITION);
|
||||
view->scrollTo(scrollParams);
|
||||
|
||||
std::vector<ErrorInfo> errors;
|
||||
m_collection = m_storageAccess->getErrorSourceLocationsLimited(&errors);
|
||||
std::vector<ErrorInfo> errors = message->errors;
|
||||
if (!errors.size())
|
||||
{
|
||||
errors = m_storageAccess->getErrorsLimited();
|
||||
}
|
||||
|
||||
m_collection = m_storageAccess->getErrorSourceLocations(errors);
|
||||
std::vector<CodeSnippetParams> snippets = getSnippetsForCollection(m_collection);
|
||||
|
||||
std::sort(snippets.begin(), snippets.end(), CodeSnippetParams::sortById);
|
||||
|
||||
@@ -80,7 +80,12 @@ void ErrorController::handleMessage(MessageShowErrors* message)
|
||||
|
||||
clear();
|
||||
|
||||
std::vector<ErrorInfo> errors = m_storageAccess->getErrorsLimited();
|
||||
std::vector<ErrorInfo> errors = message->errors;
|
||||
if (!errors.size())
|
||||
{
|
||||
errors = m_storageAccess->getErrorsLimited();
|
||||
}
|
||||
|
||||
if (errors.size())
|
||||
{
|
||||
getView()->showDockWidget();
|
||||
|
||||
@@ -59,7 +59,7 @@ void StatusBarController::handleMessage(MessageRefresh* message)
|
||||
|
||||
void StatusBarController::handleMessage(MessageShowErrors* message)
|
||||
{
|
||||
if (message->errorId || message->isReplayed())
|
||||
if (message->errorId || message->errors.size() || message->isReplayed())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -273,7 +273,8 @@ void UndoRedoController::handleMessage(MessageSearchFullText* message)
|
||||
void UndoRedoController::handleMessage(MessageShowErrors* message)
|
||||
{
|
||||
if (sameMessageTypeAsLast(message) &&
|
||||
static_cast<MessageShowErrors*>(lastMessage())->errorId == message->errorId)
|
||||
static_cast<MessageShowErrors*>(lastMessage())->errorId == message->errorId &&
|
||||
static_cast<MessageShowErrors*>(lastMessage())->errors.size() == message->errors.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,9 @@ public:
|
||||
|
||||
virtual ErrorCountInfo getErrorCount() const = 0;
|
||||
virtual std::vector<ErrorInfo> getErrorsLimited() const = 0;
|
||||
virtual std::shared_ptr<SourceLocationCollection> getErrorSourceLocationsLimited(std::vector<ErrorInfo>* errors) const = 0;
|
||||
virtual std::vector<ErrorInfo> getErrorsForFileLimited(const FilePath& filePath) const = 0;
|
||||
virtual std::shared_ptr<SourceLocationCollection> getErrorSourceLocations(
|
||||
const std::vector<ErrorInfo>& errors) const = 0;
|
||||
|
||||
virtual void setErrorFilter(const ErrorFilter& filter);
|
||||
|
||||
|
||||
@@ -332,11 +332,22 @@ std::vector<ErrorInfo> StorageAccessProxy::getErrorsLimited() const
|
||||
return std::vector<ErrorInfo>();
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceLocationCollection> StorageAccessProxy::getErrorSourceLocationsLimited(std::vector<ErrorInfo>* errors) const
|
||||
std::vector<ErrorInfo> StorageAccessProxy::getErrorsForFileLimited(const FilePath& filePath) const
|
||||
{
|
||||
if (hasSubject())
|
||||
{
|
||||
return m_subject->getErrorSourceLocationsLimited(errors);
|
||||
return m_subject->getErrorsForFileLimited(filePath);
|
||||
}
|
||||
|
||||
return std::vector<ErrorInfo>();
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceLocationCollection> StorageAccessProxy::getErrorSourceLocations(
|
||||
const std::vector<ErrorInfo>& errors) const
|
||||
{
|
||||
if (hasSubject())
|
||||
{
|
||||
return m_subject->getErrorSourceLocations(errors);
|
||||
}
|
||||
|
||||
return std::make_shared<SourceLocationCollection>();
|
||||
|
||||
@@ -68,7 +68,9 @@ public:
|
||||
|
||||
virtual ErrorCountInfo getErrorCount() const override;
|
||||
virtual std::vector<ErrorInfo> getErrorsLimited() const override;
|
||||
virtual std::shared_ptr<SourceLocationCollection> getErrorSourceLocationsLimited(std::vector<ErrorInfo>* errors) const override;
|
||||
virtual std::vector<ErrorInfo> getErrorsForFileLimited(const FilePath& filePath) const override;
|
||||
virtual std::shared_ptr<SourceLocationCollection> getErrorSourceLocations(
|
||||
const std::vector<ErrorInfo>& errors) const override;
|
||||
|
||||
// TODO: remove these from access because it's not a getter!
|
||||
virtual Id addNodeBookmark(const NodeBookmark& bookmark) override;
|
||||
|
||||
@@ -1452,44 +1452,83 @@ std::vector<ErrorInfo> PersistentStorage::getErrorsLimited() const
|
||||
if (m_errorFilter.filter(error))
|
||||
{
|
||||
errors.push_back(error);
|
||||
}
|
||||
|
||||
if (m_errorFilter.limit > 0 && errors.size() >= m_errorFilter.limit)
|
||||
{
|
||||
break;
|
||||
if (m_errorFilter.limit > 0 && errors.size() >= m_errorFilter.limit)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceLocationCollection> PersistentStorage::getErrorSourceLocationsLimited(std::vector<ErrorInfo>* errors) const
|
||||
std::vector<ErrorInfo> PersistentStorage::getErrorsForFileLimited(const FilePath& filePath) const
|
||||
{
|
||||
std::unordered_map<Id, std::set<Id>> includingMap = getFileIdToIncludedFileIdMap();
|
||||
|
||||
std::set<FilePath> filePaths;
|
||||
filePaths.insert(filePath);
|
||||
|
||||
std::set<Id> fileIdsToProcess = includingMap[getFileNodeId(filePath)];
|
||||
std::set<Id> processedFileIds;
|
||||
while (fileIdsToProcess.size())
|
||||
{
|
||||
std::set<Id> nextFileIdsToProcess;
|
||||
for (Id id : fileIdsToProcess)
|
||||
{
|
||||
if (filePaths.insert(getFileNodePath(id)).second)
|
||||
{
|
||||
utility::append(nextFileIdsToProcess, includingMap[id]);
|
||||
}
|
||||
}
|
||||
fileIdsToProcess = nextFileIdsToProcess;
|
||||
}
|
||||
|
||||
std::vector<ErrorInfo> errors;
|
||||
|
||||
for (const ErrorInfo& error : m_sqliteIndexStorage.getAll<StorageError>())
|
||||
{
|
||||
if (m_errorFilter.filter(error) && filePaths.find(FilePath(error.filePath)) != filePaths.end())
|
||||
{
|
||||
errors.push_back(error);
|
||||
|
||||
if (m_errorFilter.limit > 0 && errors.size() >= m_errorFilter.limit)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceLocationCollection> PersistentStorage::getErrorSourceLocations(
|
||||
const std::vector<ErrorInfo>& errors) const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::shared_ptr<SourceLocationCollection> collection = std::make_shared<SourceLocationCollection>();
|
||||
for (const ErrorInfo& error : m_sqliteIndexStorage.getAll<StorageError>())
|
||||
size_t count = 0;
|
||||
for (const ErrorInfo& error : errors)
|
||||
{
|
||||
if (m_errorFilter.filter(error))
|
||||
{
|
||||
errors->push_back(error);
|
||||
// Set first bit to 1 to avoid collisions
|
||||
Id locationId = ~(~Id(0) >> 1) + error.id;
|
||||
|
||||
// Set first bit to 1 to avoid collisions
|
||||
Id locationId = ~(~Id(0) >> 1) + error.id;
|
||||
collection->addSourceLocation(
|
||||
LOCATION_ERROR,
|
||||
locationId,
|
||||
std::vector<Id>(1, error.id),
|
||||
FilePath(error.filePath),
|
||||
error.lineNumber,
|
||||
error.columnNumber,
|
||||
error.lineNumber,
|
||||
error.columnNumber
|
||||
);
|
||||
|
||||
collection->addSourceLocation(
|
||||
LOCATION_ERROR,
|
||||
locationId,
|
||||
std::vector<Id>(1, error.id),
|
||||
FilePath(error.filePath),
|
||||
error.lineNumber,
|
||||
error.columnNumber,
|
||||
error.lineNumber,
|
||||
error.columnNumber
|
||||
);
|
||||
}
|
||||
count++;
|
||||
|
||||
if (m_errorFilter.limit > 0 && errors->size() >= m_errorFilter.limit)
|
||||
if (m_errorFilter.limit > 0 && count >= m_errorFilter.limit)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -2002,6 +2041,16 @@ std::unordered_map<Id, std::set<Id>> PersistentStorage::getFileIdToIncludingFile
|
||||
return fileIdToIncludingFileIdMap;
|
||||
}
|
||||
|
||||
std::unordered_map<Id, std::set<Id>> PersistentStorage::getFileIdToIncludedFileIdMap() const
|
||||
{
|
||||
std::unordered_map<Id, std::set<Id>> fileIdToIncludingFileIdMap;
|
||||
for (const StorageEdge& includeEdge : m_sqliteIndexStorage.getEdgesByType(Edge::typeToInt(Edge::EDGE_INCLUDE)))
|
||||
{
|
||||
fileIdToIncludingFileIdMap[includeEdge.sourceNodeId].insert(includeEdge.targetNodeId);
|
||||
}
|
||||
return fileIdToIncludingFileIdMap;
|
||||
}
|
||||
|
||||
std::unordered_map<Id, std::set<Id>> PersistentStorage::getFileIdToImportingFileIdMap() const
|
||||
{
|
||||
std::unordered_map<Id, std::set<Id>> fileIdToImportingFileIdMap;
|
||||
@@ -2589,13 +2638,13 @@ void PersistentStorage::buildFullTextSearchIndex() const
|
||||
TextCodec codec(ApplicationSettings::getInstance()->getTextEncoding());
|
||||
|
||||
m_fullTextSearchCodec = codec.getName();
|
||||
|
||||
|
||||
m_fullTextSearchIndex.clear();
|
||||
for (StorageFile& file : m_sqliteIndexStorage.getAll<StorageFile>())
|
||||
{
|
||||
|
||||
m_fullTextSearchIndex.addFile(
|
||||
file.id,
|
||||
file.id,
|
||||
codec.decode(m_sqliteIndexStorage.getFileContentById(file.id)->getText())
|
||||
);
|
||||
}
|
||||
|
||||
@@ -125,7 +125,9 @@ public:
|
||||
virtual ErrorCountInfo getErrorCount(const std::vector<ErrorInfo>& errors) const;
|
||||
virtual std::vector<ErrorInfo> getErrors() const;
|
||||
virtual std::vector<ErrorInfo> getErrorsLimited() const override;
|
||||
virtual std::shared_ptr<SourceLocationCollection> getErrorSourceLocationsLimited(std::vector<ErrorInfo>* errors) const override;
|
||||
virtual std::vector<ErrorInfo> getErrorsForFileLimited(const FilePath& filePath) const override;
|
||||
virtual std::shared_ptr<SourceLocationCollection> getErrorSourceLocations(
|
||||
const std::vector<ErrorInfo>& errors) const override;
|
||||
|
||||
virtual Id addNodeBookmark(const NodeBookmark& bookmark) override;
|
||||
virtual Id addEdgeBookmark(const EdgeBookmark& bookmark) override;
|
||||
@@ -153,6 +155,7 @@ private:
|
||||
bool getFileNodeComplete(Id fileId) const;
|
||||
|
||||
std::unordered_map<Id, std::set<Id>> getFileIdToIncludingFileIdMap() const;
|
||||
std::unordered_map<Id, std::set<Id>> getFileIdToIncludedFileIdMap() const;
|
||||
std::unordered_map<Id, std::set<Id>> getFileIdToImportingFileIdMap() const;
|
||||
std::set<Id> getReferenced(const std::set<Id>& filePaths, std::unordered_map<Id, std::set<Id>> idToReferencingIdMap) const;
|
||||
std::set<Id> getReferencing(const std::set<Id>& filePaths, std::unordered_map<Id, std::set<Id>> idToReferencingIdMap) const;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
#include "data/ErrorCountInfo.h"
|
||||
#include "data/ErrorInfo.h"
|
||||
|
||||
class MessageShowErrors
|
||||
: public Message<MessageShowErrors>
|
||||
@@ -15,6 +16,12 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
MessageShowErrors(const std::vector<ErrorInfo>& errors)
|
||||
: errors(errors)
|
||||
, errorId(0)
|
||||
{
|
||||
}
|
||||
|
||||
MessageShowErrors(Id errorId)
|
||||
: errorId(errorId)
|
||||
{
|
||||
@@ -25,8 +32,9 @@ public:
|
||||
return "MessageShowErrors";
|
||||
}
|
||||
|
||||
ErrorCountInfo errorCount;
|
||||
Id errorId;
|
||||
const ErrorCountInfo errorCount;
|
||||
const std::vector<ErrorInfo> errors;
|
||||
const Id errorId;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_SHOW_ERRORS_H
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef MESSAGE_SHOW_ERRORS_FOR_FILE_H
|
||||
#define MESSAGE_SHOW_ERRORS_FOR_FILE_H
|
||||
|
||||
#include "utility/file/FilePath.h"
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageShowErrorsForFile
|
||||
: public Message<MessageShowErrorsForFile>
|
||||
{
|
||||
public:
|
||||
MessageShowErrorsForFile(const FilePath& filePath)
|
||||
: filePath(filePath)
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageShowErrorsForFile";
|
||||
}
|
||||
|
||||
const FilePath filePath;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_SHOW_ERRORS_FOR_FILE_H
|
||||
@@ -305,7 +305,7 @@ void QtCodeFile::setWholeFile(bool isWholeFile, int refCount)
|
||||
|
||||
void QtCodeFile::setIsComplete(bool isComplete)
|
||||
{
|
||||
m_titleBar->getTitleButton()->setIsComplete(isComplete);
|
||||
m_titleBar->setIsComplete(isComplete);
|
||||
}
|
||||
|
||||
void QtCodeFile::setMinimized()
|
||||
|
||||
@@ -304,13 +304,13 @@ void QtCodeFileSingle::setFileData(const FileData& file)
|
||||
if (!file.title.empty())
|
||||
{
|
||||
titleButton->setProject(file.title);
|
||||
titleButton->setIsComplete(true);
|
||||
m_titleBar->setIsComplete(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
titleButton->setFilePath(file.filePath);
|
||||
titleButton->setModificationTime(file.modificationTime);
|
||||
titleButton->setIsComplete(file.isComplete);
|
||||
m_titleBar->setIsComplete(file.isComplete);
|
||||
}
|
||||
|
||||
updateRefCount(m_area->getActiveLocationCount());
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <QVariant>
|
||||
|
||||
#include "utility/ResourcePaths.h"
|
||||
#include "utility/messaging/type/MessageShowErrorsForFile.h"
|
||||
|
||||
QtCodeFileTitleBar::QtCodeFileTitleBar(QWidget* parent, bool isHovering, bool isSingle)
|
||||
: QtHoverButton(parent)
|
||||
@@ -41,6 +42,20 @@ QtCodeFileTitleBar::QtCodeFileTitleBar(QWidget* parent, bool isHovering, bool is
|
||||
|
||||
titleLayout->addStretch(3);
|
||||
|
||||
m_showErrorsButton = new QPushButton("show errors");
|
||||
m_showErrorsButton->setObjectName("screen_button");
|
||||
m_showErrorsButton->setToolTip("Show all errors related to this file");
|
||||
m_showErrorsButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
m_showErrorsButton->hide();
|
||||
titleLayout->addWidget(m_showErrorsButton);
|
||||
|
||||
connect(m_showErrorsButton, &QPushButton::clicked,
|
||||
[this]()
|
||||
{
|
||||
MessageShowErrorsForFile(m_titleButton->getFilePath()).dispatch();
|
||||
}
|
||||
);
|
||||
|
||||
FilePath imageDir = ResourcePaths::getGuiPath().concatenate(L"code_view/images/");
|
||||
QColor inactiveColor(0x5E, 0x5D, 0x5D);
|
||||
|
||||
@@ -94,6 +109,12 @@ QtCodeFileTitleButton* QtCodeFileTitleBar::getTitleButton() const
|
||||
return m_titleButton;
|
||||
}
|
||||
|
||||
void QtCodeFileTitleBar::setIsComplete(bool isComplete)
|
||||
{
|
||||
m_titleButton->setIsComplete(isComplete);
|
||||
m_showErrorsButton->setVisible(!isComplete);
|
||||
}
|
||||
|
||||
void QtCodeFileTitleBar::updateRefCount(int refCount, bool hasErrors, size_t fatalErrorCount)
|
||||
{
|
||||
if (refCount > 0)
|
||||
@@ -158,6 +179,7 @@ void QtCodeFileTitleBar::setMaximized()
|
||||
void QtCodeFileTitleBar::updateFromOther(const QtCodeFileTitleBar* other)
|
||||
{
|
||||
m_titleButton->updateFromOther(other->getTitleButton());
|
||||
setIsComplete(m_titleButton->isComplete());
|
||||
|
||||
QString refString = other->m_referenceCount->text();
|
||||
if (refString.size())
|
||||
|
||||
@@ -23,6 +23,7 @@ public:
|
||||
|
||||
QtCodeFileTitleButton* getTitleButton() const;
|
||||
|
||||
void setIsComplete(bool isComplete);
|
||||
void updateRefCount(int refCount, bool hasErrors, size_t fatalErrorCount);
|
||||
|
||||
void setMinimized();
|
||||
@@ -43,6 +44,7 @@ private slots:
|
||||
|
||||
private:
|
||||
QtCodeFileTitleButton* m_titleButton;
|
||||
QPushButton* m_showErrorsButton;
|
||||
QLabel* m_referenceCount;
|
||||
|
||||
QtIconStateButton* m_minimizeButton;
|
||||
|
||||
@@ -32,6 +32,11 @@ QtCodeFileTitleButton::~QtCodeFileTitleButton()
|
||||
{
|
||||
}
|
||||
|
||||
const FilePath& QtCodeFileTitleButton::getFilePath() const
|
||||
{
|
||||
return m_filePath;
|
||||
}
|
||||
|
||||
void QtCodeFileTitleButton::setFilePath(const FilePath& filePath)
|
||||
{
|
||||
setEnabled(true);
|
||||
@@ -56,6 +61,24 @@ void QtCodeFileTitleButton::setModificationTime(const TimeStamp modificationTime
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeFileTitleButton::setProject(const std::wstring& name)
|
||||
{
|
||||
m_filePath = FilePath();
|
||||
|
||||
setText(QString::fromStdWString(name));
|
||||
setToolTip("edit project");
|
||||
|
||||
setIcon(utility::colorizePixmap(
|
||||
QPixmap(QString::fromStdWString(ResourcePaths::getGuiPath().concatenate(L"code_view/images/edit.png").wstr())),
|
||||
ColorScheme::getInstance()->getColor("code/file/title/icon").c_str()
|
||||
));
|
||||
}
|
||||
|
||||
bool QtCodeFileTitleButton::isComplete() const
|
||||
{
|
||||
return m_isComplete;
|
||||
}
|
||||
|
||||
void QtCodeFileTitleButton::setIsComplete(bool isComplete)
|
||||
{
|
||||
if (m_isComplete == isComplete)
|
||||
@@ -82,19 +105,6 @@ void QtCodeFileTitleButton::setIsComplete(bool isComplete)
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeFileTitleButton::setProject(const std::wstring& name)
|
||||
{
|
||||
m_filePath = FilePath();
|
||||
|
||||
setText(QString::fromStdWString(name));
|
||||
setToolTip("edit project");
|
||||
|
||||
setIcon(utility::colorizePixmap(
|
||||
QPixmap(QString::fromStdWString(ResourcePaths::getGuiPath().concatenate(L"code_view/images/edit.png").wstr())),
|
||||
ColorScheme::getInstance()->getColor("code/file/title/icon").c_str()
|
||||
));
|
||||
}
|
||||
|
||||
void QtCodeFileTitleButton::updateTexts()
|
||||
{
|
||||
if (m_filePath.empty())
|
||||
|
||||
@@ -15,11 +15,15 @@ public:
|
||||
QtCodeFileTitleButton(QWidget* parent = nullptr);
|
||||
virtual ~QtCodeFileTitleButton();
|
||||
|
||||
const FilePath& getFilePath() const;
|
||||
void setFilePath(const FilePath& filePath);
|
||||
|
||||
void setModificationTime(const TimeStamp modificationTime);
|
||||
void setIsComplete(bool isComplete);
|
||||
void setProject(const std::wstring& name);
|
||||
|
||||
bool isComplete() const;
|
||||
void setIsComplete(bool isComplete);
|
||||
|
||||
void updateTexts();
|
||||
|
||||
void updateFromOther(const QtCodeFileTitleButton* other);
|
||||
|
||||
@@ -158,6 +158,7 @@ void QtErrorView::initView()
|
||||
|
||||
{
|
||||
m_allButton = new QPushButton("");
|
||||
m_allButton->setObjectName("screen_button");
|
||||
connect(m_allButton, &QPushButton::clicked,
|
||||
[=]()
|
||||
{
|
||||
@@ -173,17 +174,17 @@ void QtErrorView::initView()
|
||||
|
||||
|
||||
{
|
||||
QPushButton* editButton = new QPushButton("Edit Project");
|
||||
connect(editButton, &QPushButton::clicked,
|
||||
m_editButton = new QPushButton("Edit Project");
|
||||
m_editButton->setObjectName("screen_button");
|
||||
connect(m_editButton, &QPushButton::clicked,
|
||||
[]()
|
||||
{
|
||||
MessageProjectEdit().dispatch();
|
||||
}
|
||||
);
|
||||
checkboxes->addWidget(editButton);
|
||||
checkboxes->addWidget(m_editButton);
|
||||
|
||||
editButton->setToolTip("edit project");
|
||||
editButton->setIcon(QPixmap(QString::fromStdWString(ResourcePaths::getGuiPath().concatenate(L"code_view/images/edit.png").wstr())));
|
||||
m_editButton->setToolTip("edit project");
|
||||
}
|
||||
|
||||
checkboxes->addSpacing(10);
|
||||
@@ -308,6 +309,11 @@ void QtErrorView::setStyleSheet() const
|
||||
|
||||
m_helpButton->setColor(QColor(ColorScheme::getInstance()->getColor("table/text/normal").c_str()));
|
||||
|
||||
m_editButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().concatenate(L"code_view/images/edit.png"),
|
||||
"window/button"
|
||||
));
|
||||
|
||||
m_table->updateRows();
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ private:
|
||||
QCheckBox* m_showNonIndexedFatals;
|
||||
|
||||
QtHelpButton* m_helpButton;
|
||||
QPushButton* m_editButton;
|
||||
|
||||
QStandardItemModel* m_model;
|
||||
QtTable* m_table;
|
||||
|
||||
@@ -63,6 +63,7 @@ void QtStatusView::initView()
|
||||
filters->addStretch();
|
||||
|
||||
QPushButton* clearButton = new QPushButton("Clear Table");
|
||||
clearButton->setObjectName("screen_button");
|
||||
connect(clearButton, &QPushButton::clicked,
|
||||
[=]()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user