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
+4 -4
View File
@@ -26,7 +26,7 @@ QtStatusBar::QtStatusBar()
m_text.setFlat(true);
m_text.setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
addWidget(&m_text);
addWidget(&m_text, 1);
setText("", false, false);
connect(&m_text, SIGNAL(clicked()), this, SLOT(showStatus()));
@@ -52,11 +52,11 @@ void QtStatusBar::setText(const std::string& text, bool isError, bool showLoader
{
if (isError)
{
m_text.setStyleSheet("QPushButton { color: #D00000; margin-right: 0; spacing: none; }");
m_text.setStyleSheet("QPushButton { color: #D00000; margin-right: 0; spacing: none; text-align: left; }");
}
else
{
m_text.setStyleSheet("QPushButton { color: #000000; margin-right: 0; spacing: none; }");
m_text.setStyleSheet("QPushButton { color: #000000; margin-right: 0; spacing: none; text-align: left; }");
}
if (showLoader)
@@ -68,7 +68,7 @@ void QtStatusBar::setText(const std::string& text, bool isError, bool showLoader
m_loader.hide();
}
m_text.setText(text.c_str());
m_text.setText(m_text.fontMetrics().elidedText(QString::fromStdString(text), Qt::ElideRight, m_text.width()));
}
void QtStatusBar::setErrorCount(ErrorCountInfo errorCount)
+9 -6
View File
@@ -105,12 +105,15 @@ DialogView::IndexMode QtDialogView::startIndexingDialog(
void QtDialogView::updateIndexingDialog(size_t fileCount, size_t totalFileCount, std::string sourcePath)
{
std::stringstream ss;
ss << "Indexing files: [";
ss << fileCount << "/";
ss << totalFileCount << "] ";
ss << sourcePath;
MessageStatus(ss.str(), false, true).dispatch();
if (sourcePath.size())
{
std::stringstream ss;
ss << "Indexing files: [";
ss << fileCount << "/";
ss << totalFileCount << "] ";
ss << sourcePath;
MessageStatus(ss.str(), false, true).dispatch();
}
m_onQtThread(
[=]()
+7 -2
View File
@@ -7,6 +7,7 @@
#include <QPushButton>
#include <QStandardItemModel>
#include "Application.h"
#include "settings/ApplicationSettings.h"
#include "settings/ColorScheme.h"
#include "qt/view/QtViewWidgetWrapper.h"
@@ -143,8 +144,10 @@ void QtLogView::setLoggingEnabled(bool enabled)
ApplicationSettings::getInstance()->setLoggingEnabled(enabled);
ApplicationSettings::getInstance()->save();
Application::getInstance()->loadSettings();
MessageRefresh msg;
msg.reloadSettings = true;
msg.uiOnly = true;
msg.dispatchImmediately();
}
@@ -153,8 +156,10 @@ void QtLogView::setAstLoggingEnabled(bool enabled)
{
ApplicationSettings::getInstance()->setVerboseIndexerLoggingEnabled(enabled);
ApplicationSettings::getInstance()->save();
Application::getInstance()->loadSettings();
MessageRefresh msg;
msg.reloadSettings = true;
msg.uiOnly = true;
msg.dispatchImmediately();
}
@@ -643,6 +643,10 @@ void QtProjectWizzard::createProject()
forceRefreshProject = true;
}
}
else
{
MessageStatus("Created project: " + path.str()).dispatch();
}
MessageDispatchWhenLicenseValid(
std::make_shared<MessageLoadProject>(path, forceRefreshProject)
@@ -666,6 +670,8 @@ void QtProjectWizzard::savePreferences()
MessagePluginPortChange().dispatch();
}
Application::getInstance()->loadSettings();
if (appSettingsChanged)
{
Project* currentProject = Application::getInstance()->getCurrentProject().get();