logic: More fixes for release
* Fixed crash on undoing aggregation edge * Avoid mutex locking in logging classes when logging is disabled * Readded dark color scheme * Fixed font size of type label in autocompletion list * Fixed text drawing in autocompletion list * Only give camelcase score when no noletter score was given * Added MessageShowErrors to undo stack * Select error line in table when undoing MessageShowErrors * Notify user about new Plugin in description of From Visual Studio project setup * Fixed row height of Project File Location label in project setup
This commit is contained in:
+1
-17
@@ -1,7 +1,5 @@
|
||||
#include "Application.h"
|
||||
|
||||
#include "utility/logging/ConsoleLogger.h"
|
||||
#include "utility/logging/FileLogger.h"
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/logging/LogManager.h"
|
||||
#include "utility/messaging/MessageQueue.h"
|
||||
@@ -76,21 +74,7 @@ void Application::loadSettings()
|
||||
settings->load(FilePath(UserPaths::getAppSettingsPath()));
|
||||
|
||||
LogManager* logManager = LogManager::getInstance().get();
|
||||
if (!settings->getLoggingEnabled())
|
||||
{
|
||||
logManager->clearLoggers();
|
||||
}
|
||||
else if (!logManager->getLoggerCount())
|
||||
{
|
||||
std::shared_ptr<ConsoleLogger> consoleLogger = std::make_shared<ConsoleLogger>();
|
||||
consoleLogger->setLogLevel(Logger::LOG_WARNINGS | Logger::LOG_ERRORS);
|
||||
logManager->addLogger(consoleLogger);
|
||||
|
||||
std::shared_ptr<FileLogger> fileLogger = std::make_shared<FileLogger>();
|
||||
fileLogger->setLogDirectory(UserPaths::getLogPath());
|
||||
fileLogger->setLogLevel(Logger::LOG_ALL);
|
||||
logManager->addLogger(fileLogger);
|
||||
}
|
||||
logManager->setLoggingEnabled(settings->getLoggingEnabled());
|
||||
|
||||
loadStyle(settings->getColorSchemePath());
|
||||
}
|
||||
|
||||
@@ -42,6 +42,10 @@ void ErrorController::handleMessage(MessageShowErrors* message)
|
||||
{
|
||||
if (message->errorId)
|
||||
{
|
||||
if (message->isReplayed())
|
||||
{
|
||||
getView()->setErrorId(message->errorId);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "utility/messaging/type/MessageActivateTokens.h"
|
||||
#include "utility/messaging/type/MessageChangeFileView.h"
|
||||
#include "utility/messaging/type/MessageColorSchemeTest.h"
|
||||
#include "utility/messaging/type/MessageFlushUpdates.h"
|
||||
#include "utility/messaging/type/MessageRefresh.h"
|
||||
#include "utility/messaging/type/MessageShowErrors.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
@@ -138,8 +139,9 @@ void FeatureController::handleMessage(MessageSearch* message)
|
||||
case SearchMatch::COMMAND_ERROR:
|
||||
{
|
||||
MessageShowErrors msg(m_storageAccess->getErrorCount());
|
||||
msg.setIsReplayed(message->isReplayed());
|
||||
msg.dispatchImmediately();
|
||||
msg.setIsReplayed(true);
|
||||
msg.dispatch();
|
||||
MessageFlushUpdates().dispatch();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -235,6 +235,18 @@ void UndoRedoController::handleMessage(MessageSearchFullText* message)
|
||||
processCommand(command);
|
||||
}
|
||||
|
||||
void UndoRedoController::handleMessage(MessageShowErrors* message)
|
||||
{
|
||||
if (sameMessageTypeAsLast(message) &&
|
||||
static_cast<MessageShowErrors*>(lastMessage())->errorId == message->errorId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Command command(std::make_shared<MessageShowErrors>(*message), Command::ORDER_ACTIVATE);
|
||||
processCommand(command);
|
||||
}
|
||||
|
||||
void UndoRedoController::handleMessage(MessageShowScope* message)
|
||||
{
|
||||
Command command(std::make_shared<MessageShowScope>(*message), Command::ORDER_VIEW);
|
||||
@@ -347,6 +359,11 @@ void UndoRedoController::replayCommands(std::list<Command>::iterator it)
|
||||
|
||||
void UndoRedoController::processCommand(Command command)
|
||||
{
|
||||
if (command.message->isReplayed())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (command.order != Command::ORDER_ACTIVATE && m_iterator == m_list.begin())
|
||||
{
|
||||
return;
|
||||
@@ -357,40 +374,37 @@ void UndoRedoController::processCommand(Command command)
|
||||
command.order = Command::ORDER_ADAPT;
|
||||
}
|
||||
|
||||
if (!command.message->isReplayed())
|
||||
if (command.order == Command::ORDER_ACTIVATE)
|
||||
{
|
||||
if (command.order == Command::ORDER_ACTIVATE)
|
||||
m_iterator = m_list.erase(m_iterator, m_list.end());
|
||||
}
|
||||
else if (command.order == Command::ORDER_ADAPT)
|
||||
{
|
||||
std::list<Command>::iterator end = m_iterator;
|
||||
while (end != m_list.end())
|
||||
{
|
||||
m_iterator = m_list.erase(m_iterator, m_list.end());
|
||||
}
|
||||
else if (command.order == Command::ORDER_ADAPT)
|
||||
{
|
||||
std::list<Command>::iterator end = m_iterator;
|
||||
while (end != m_list.end())
|
||||
if (end->order == Command::ORDER_ACTIVATE)
|
||||
{
|
||||
if (end->order == Command::ORDER_ACTIVATE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
std::advance(end, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
m_iterator = m_list.erase(m_iterator, end);
|
||||
std::advance(end, 1);
|
||||
}
|
||||
|
||||
m_list.insert(m_iterator, command);
|
||||
m_iterator = m_list.erase(m_iterator, end);
|
||||
}
|
||||
|
||||
if (command.order != Command::ORDER_VIEW)
|
||||
m_list.insert(m_iterator, command);
|
||||
|
||||
if (command.order != Command::ORDER_VIEW)
|
||||
{
|
||||
if (m_list.begin() != std::prev(m_iterator))
|
||||
{
|
||||
if (m_list.begin() != std::prev(m_iterator))
|
||||
{
|
||||
getView()->setUndoButtonEnabled(true);
|
||||
}
|
||||
getView()->setUndoButtonEnabled(true);
|
||||
}
|
||||
|
||||
if (m_list.end() == m_iterator)
|
||||
{
|
||||
getView()->setRedoButtonEnabled(false);
|
||||
}
|
||||
if (m_list.end() == m_iterator)
|
||||
{
|
||||
getView()->setRedoButtonEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "utility/messaging/type/MessageScrollCode.h"
|
||||
#include "utility/messaging/type/MessageSearch.h"
|
||||
#include "utility/messaging/type/MessageSearchFullText.h"
|
||||
#include "utility/messaging/type/MessageShowErrors.h"
|
||||
#include "utility/messaging/type/MessageShowScope.h"
|
||||
#include "utility/messaging/type/MessageUndo.h"
|
||||
|
||||
@@ -45,6 +46,7 @@ class UndoRedoController
|
||||
, public MessageListener<MessageScrollCode>
|
||||
, public MessageListener<MessageSearch>
|
||||
, public MessageListener<MessageSearchFullText>
|
||||
, public MessageListener<MessageShowErrors>
|
||||
, public MessageListener<MessageShowScope>
|
||||
, public MessageListener<MessageUndo>
|
||||
{
|
||||
@@ -88,6 +90,7 @@ private:
|
||||
virtual void handleMessage(MessageScrollCode* message);
|
||||
virtual void handleMessage(MessageSearch* message);
|
||||
virtual void handleMessage(MessageSearchFullText* message);
|
||||
virtual void handleMessage(MessageShowErrors* message);
|
||||
virtual void handleMessage(MessageShowScope* message);
|
||||
virtual void handleMessage(MessageUndo* message);
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ public:
|
||||
virtual void clear() = 0;
|
||||
|
||||
virtual void addError(const StorageError& error) = 0;
|
||||
virtual void setErrorId(Id errorId) = 0;
|
||||
};
|
||||
|
||||
#endif // ERROR_VIEW_H
|
||||
|
||||
@@ -389,8 +389,14 @@ int SearchIndex::score(const std::string& text, const std::vector<size_t>& indic
|
||||
|
||||
size_t index = indices[i];
|
||||
|
||||
// after no letter
|
||||
bool prevIsNoLetter = (index == 0 || noLetters.find(text[index - 1]) != noLetters.end());
|
||||
if (prevIsNoLetter)
|
||||
{
|
||||
noLetterScore += noLetterBonus;
|
||||
}
|
||||
// camel case
|
||||
if (isupper(text[index]))
|
||||
else if (isupper(text[index]))
|
||||
{
|
||||
bool prevIsLower = (index > 0 && islower(text[index - 1]));
|
||||
bool nextIsLower = (index + 1 == text.size() || islower(text[index + 1]));
|
||||
@@ -400,13 +406,6 @@ int SearchIndex::score(const std::string& text, const std::vector<size_t>& indic
|
||||
camelCaseScore += camelCaseBonus;
|
||||
}
|
||||
}
|
||||
|
||||
// after no letter
|
||||
bool prevIsNoLetter = (index == 0 || noLetters.find(text[index - 1]) != noLetters.end());
|
||||
if (prevIsNoLetter)
|
||||
{
|
||||
noLetterScore += noLetterBonus;
|
||||
}
|
||||
}
|
||||
|
||||
int leadingStartScore = std::max(int(indices[0]) * delayedStartBonus, minDelayedStartBonus);
|
||||
|
||||
@@ -4,9 +4,8 @@
|
||||
|
||||
#include "utility/logging/LogMessage.h"
|
||||
|
||||
std::shared_ptr<LogManager> LogManager::getInstance()
|
||||
std::shared_ptr<LogManager> LogManager::createInstance()
|
||||
{
|
||||
std::lock_guard<std::mutex> lockGuard(s_instanceMutex);
|
||||
if (s_instance.use_count() == 0)
|
||||
{
|
||||
s_instance = std::shared_ptr<LogManager>(new LogManager());
|
||||
@@ -14,9 +13,13 @@ std::shared_ptr<LogManager> LogManager::getInstance()
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
std::shared_ptr<LogManager> LogManager::getInstance()
|
||||
{
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
void LogManager::destroyInstance()
|
||||
{
|
||||
std::lock_guard<std::mutex> lockGuard(s_instanceMutex);
|
||||
s_instance.reset();
|
||||
}
|
||||
|
||||
@@ -24,6 +27,11 @@ LogManager::~LogManager()
|
||||
{
|
||||
}
|
||||
|
||||
void LogManager::setLoggingEnabled(bool enabled)
|
||||
{
|
||||
m_loggingEnabled = enabled;
|
||||
}
|
||||
|
||||
void LogManager::addLogger(std::shared_ptr<Logger> logger)
|
||||
{
|
||||
m_logManagerImplementation.addLogger(logger);
|
||||
@@ -56,7 +64,10 @@ void LogManager::logInfo(
|
||||
const unsigned int line
|
||||
)
|
||||
{
|
||||
m_logManagerImplementation.logInfo(message, file, function, line);
|
||||
if (m_loggingEnabled)
|
||||
{
|
||||
m_logManagerImplementation.logInfo(message, file, function, line);
|
||||
}
|
||||
}
|
||||
|
||||
void LogManager::logWarning(
|
||||
@@ -66,7 +77,10 @@ void LogManager::logWarning(
|
||||
const unsigned int line
|
||||
)
|
||||
{
|
||||
m_logManagerImplementation.logWarning(message, file, function, line);
|
||||
if (m_loggingEnabled)
|
||||
{
|
||||
m_logManagerImplementation.logWarning(message, file, function, line);
|
||||
}
|
||||
}
|
||||
|
||||
void LogManager::logError(
|
||||
@@ -76,12 +90,15 @@ void LogManager::logError(
|
||||
const unsigned int line
|
||||
)
|
||||
{
|
||||
m_logManagerImplementation.logError(message, file, function, line);
|
||||
if (m_loggingEnabled)
|
||||
{
|
||||
m_logManagerImplementation.logError(message, file, function, line);
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<LogManager> LogManager::s_instance;
|
||||
std::mutex LogManager::s_instanceMutex;
|
||||
|
||||
LogManager::LogManager()
|
||||
: m_loggingEnabled(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define LOG_MANAGER_H
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
#include "utility/logging/Logger.h"
|
||||
#include "utility/logging/LogManagerImplementation.h"
|
||||
@@ -10,11 +9,14 @@
|
||||
class LogManager
|
||||
{
|
||||
public:
|
||||
static std::shared_ptr<LogManager> createInstance();
|
||||
static std::shared_ptr<LogManager> getInstance();
|
||||
static void destroyInstance();
|
||||
|
||||
~LogManager();
|
||||
|
||||
void setLoggingEnabled(bool enabled);
|
||||
|
||||
void addLogger(std::shared_ptr<Logger> logger);
|
||||
void removeLogger(std::shared_ptr<Logger> logger);
|
||||
void removeLoggersByType(const std::string& type);
|
||||
@@ -42,13 +44,13 @@ public:
|
||||
|
||||
private:
|
||||
static std::shared_ptr<LogManager> s_instance;
|
||||
static std::mutex s_instanceMutex;
|
||||
|
||||
LogManager();
|
||||
LogManager(const LogManager&);
|
||||
void operator=(const LogManager&);
|
||||
|
||||
LogManagerImplementation m_logManagerImplementation;
|
||||
bool m_loggingEnabled;
|
||||
};
|
||||
|
||||
#endif // LOG_MANAGER_H
|
||||
|
||||
@@ -17,7 +17,10 @@ public:
|
||||
, fromNameHierarchy(fromName)
|
||||
, toNameHierarchy(toName)
|
||||
{
|
||||
setKeepContent(true);
|
||||
if (!isAggregation())
|
||||
{
|
||||
setKeepContent(true);
|
||||
}
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
|
||||
@@ -270,7 +270,10 @@ std::string SolutionParserVisualStudio::getButtonText() const
|
||||
|
||||
std::string SolutionParserVisualStudio::getDescription() const
|
||||
{
|
||||
return "Create a new project from an existing Visual Studio Solution file. <b>Unstable!</b>";
|
||||
return "Create a new project from an existing Visual Studio Solution file. "
|
||||
"<b>Unstable: Please install our new <a href=\"https://coati.io/documentation/index.html#VisualStudio\">Visual "
|
||||
"Studio plugin</a> and use the \"Create CDB\" menu option, then continue with project setup from "
|
||||
"Compilation Database.</b>";
|
||||
}
|
||||
|
||||
std::string SolutionParserVisualStudio::getIconPath() const
|
||||
|
||||
Reference in New Issue
Block a user