src: Added more status messages and some fixes

* Elide status bar messages to avoid window resize window
* Fixed status view clearing when switching projects
* Refactored app setting loading
* Replace newline characters with spaces in status view
This commit is contained in:
Eberhard Graether
2016-12-13 01:41:06 +01:00
parent 790afcf572
commit 48ece50eca
17 changed files with 100 additions and 48 deletions
@@ -139,6 +139,12 @@ void CodeController::handleMessage(MessageActivateTokens* message)
size_t referenceCount = m_collection->getTokenLocationCount();
std::stringstream ss;
if (message->unknownNames.size())
{
ss << "Activate \"" << message->unknownNames[0] << "\": ";
}
ss << message->tokenIds.size() << ' ';
ss << (message->tokenIds.size() == 1 ? "result" : "results");
@@ -270,8 +276,8 @@ void CodeController::handleMessage(MessageScrollToLine* message)
if (message->isModified)
{
MessageStatus(
"The file was modified, please refresh. Showing source location: " + message->filePath.str()
+ " : " + std::to_string(message->line),
"Showing source location: " + message->filePath.str()
+ " : " + std::to_string(message->line) + ". The file was modified, please refresh.",
true
).dispatch();
}
@@ -102,7 +102,9 @@ void IDECommunicationController::handleSetActiveTokenMessage(
if (selectedLocationIds.size() > 0)
{
MessageStatus("Activating a source location from plug-in succeeded.").dispatch();
MessageStatus("Activating source location from plug-in succeeded: " + message.fileLocation + ", row: " +
std::to_string(message.row) + ", col: " + std::to_string(message.column)).dispatch();
MessageDispatchWhenLicenseValid(
std::make_shared<MessageActivateTokenLocations>(selectedLocationIds)
).dispatch();
@@ -180,7 +182,7 @@ void IDECommunicationController::handlePing(const NetworkProtocolHelper::PingMes
}
// TODO: add the other ides
std::string message = ideName + " instance detected";
std::string message = ideName + " instance detected via plugin port";
MessageStatus(message, false, false).dispatch();
MessageDispatchWhenLicenseValid(msg).dispatch();
@@ -195,7 +197,7 @@ void IDECommunicationController::handleMessage(MessageIDECreateCDB* message)
{
std::string networkMessage = NetworkProtocolHelper::buildCreateCDBMessage();
MessageStatus("Requesting IDE to create CDB.").dispatch();
MessageStatus("Requesting IDE to create Compilation Database via plug-in.").dispatch();
sendMessage(networkMessage);
}
@@ -204,10 +206,10 @@ void IDECommunicationController::handleMessage(MessageMoveIDECursor* message)
{
std::string networkMessage = NetworkProtocolHelper::buildSetIDECursorMessage(
message->FilePosition, message->Row, message->Column
);
);
MessageStatus(
"Jumping the external tool to the following location: " + message->FilePosition + ", row: " +
"Jump to source location via plug-in: " + message->FilePosition + ", row: " +
std::to_string(message->Row) + ", col: " + std::to_string(message->Column)
).dispatch();
@@ -57,12 +57,10 @@ void StatusBarController::handleMessage(MessageStatus* message)
void StatusBarController::setStatus(const std::string& status, bool isError, bool showLoader)
{
std::string str = utility::replace(status, "\n", " ");
if (!str.empty())
if (!status.empty())
{
LOG_INFO_STREAM(<< "STATUS " << str);
LOG_INFO_STREAM(<< "STATUS " << status);
getView()->showMessage(str, isError, showLoader);
getView()->showMessage(status, isError, showLoader);
}
}
@@ -20,13 +20,12 @@ StatusView* StatusController::getView() const
void StatusController::clear()
{
m_status.clear();
getView()->clear();
}
void StatusController::handleMessage(MessageClearStatusView* message)
{
clear();
m_status.clear();
getView()->clear();
}
void StatusController::handleMessage(MessageShowStatus* message)
@@ -36,6 +35,11 @@ void StatusController::handleMessage(MessageShowStatus* message)
void StatusController::handleMessage(MessageStatus* message)
{
if (!message->status.size())
{
return;
}
std::vector<Status> status;
status.push_back(Status(message->status, message->isError));
@@ -25,7 +25,6 @@ public:
~StatusController();
private:
bool m_enabled;
StatusView* getView() const;
virtual void clear();