refs #608, allow to select log component (attention) when required. This is needed for direct window access to display console messages directly.

This commit is contained in:
Klaus Basan
2016-03-02 18:54:31 +01:00
committed by Mathew Sutcliffe
parent 81299b4d16
commit 5a03d235cd
6 changed files with 31 additions and 6 deletions

View File

@@ -37,6 +37,7 @@ namespace BlackGui
connect(ui->comp_Mapping, &CDbMappingComponent::requestUpdatedData, ui->comp_DataInfoArea, &CDataInfoAreaComponent::requestUpdatedData); connect(ui->comp_Mapping, &CDbMappingComponent::requestUpdatedData, ui->comp_DataInfoArea, &CDataInfoAreaComponent::requestUpdatedData);
connect(ui->comp_DataInfoArea->getModelComponent(), &CDbModelComponent::requestStash, ui->comp_Mapping, &CDbMappingComponent::stashModels); connect(ui->comp_DataInfoArea->getModelComponent(), &CDbModelComponent::requestStash, ui->comp_Mapping, &CDbMappingComponent::stashModels);
connect(ui->comp_Log, &CLogComponent::requestAttention, this, &CDataMainInfoAreaComponent::selectLog);
} }
CDataMainInfoAreaComponent::~CDataMainInfoAreaComponent() CDataMainInfoAreaComponent::~CDataMainInfoAreaComponent()
@@ -69,6 +70,11 @@ namespace BlackGui
this->getLogComponent()->displayConsole(); this->getLogComponent()->displayConsole();
} }
void CDataMainInfoAreaComponent::selectLog()
{
this->selectArea(InfoAreaLog);
}
QSize CDataMainInfoAreaComponent::getPreferredSizeWhenFloating(int areaIndex) const QSize CDataMainInfoAreaComponent::getPreferredSizeWhenFloating(int areaIndex) const
{ {
InfoArea area = static_cast<InfoArea>(areaIndex); InfoArea area = static_cast<InfoArea>(areaIndex);

View File

@@ -68,6 +68,10 @@ namespace BlackGui
//! Display console //! Display console
void displayConsole(); void displayConsole();
public slots:
//! Select log area
void selectLog();
protected: protected:
//! \copydoc CInfoArea::getPreferredSizeWhenFloating //! \copydoc CInfoArea::getPreferredSizeWhenFloating
virtual QSize getPreferredSizeWhenFloating(int areaIndex) const override; virtual QSize getPreferredSizeWhenFloating(int areaIndex) const override;

View File

@@ -47,14 +47,16 @@ namespace BlackGui
CLogComponent::~CLogComponent() CLogComponent::~CLogComponent()
{ } { }
void CLogComponent::displayLog() void CLogComponent::displayLog(bool attention)
{ {
this->ui->tw_StatusPage->setCurrentIndex(0); this->ui->tw_StatusPage->setCurrentIndex(0);
if(attention) { emit requestAttention(); }
} }
void CLogComponent::displayConsole() void CLogComponent::displayConsole(bool attention)
{ {
this->ui->tw_StatusPage->setCurrentIndex(1); this->ui->tw_StatusPage->setCurrentIndex(1);
if(attention) { emit requestAttention(); }
} }
void CLogComponent::appendStatusMessageToConsole(const CStatusMessage &statusMessage) void CLogComponent::appendStatusMessageToConsole(const CStatusMessage &statusMessage)

View File

@@ -53,10 +53,14 @@ namespace BlackGui
~CLogComponent(); ~CLogComponent();
//! Display log //! Display log
void displayLog(); void displayLog(bool attention = false);
//! Display console //! Display console
void displayConsole(); void displayConsole(bool attention = false);
signals:
//! Make me visible
void requestAttention();
public slots: public slots:
//! Append status message to console //! Append status message to console

View File

@@ -26,8 +26,9 @@ namespace BlackGui
ui(new Ui::CMainInfoAreaComponent) ui(new Ui::CMainInfoAreaComponent)
{ {
ui->setupUi(this); ui->setupUi(this);
initInfoArea(); // init base class CInfoArea::initInfoArea(); // init base class
this->setWindowIcon(CIcons::swift24()); this->setWindowIcon(CIcons::swift48());
connect(this->getLogComponent(), &CLogComponent::requestAttention, this, &CMainInfoAreaComponent::selectLog);
} }
CMainInfoAreaComponent::~CMainInfoAreaComponent() CMainInfoAreaComponent::~CMainInfoAreaComponent()
@@ -95,6 +96,11 @@ namespace BlackGui
this->selectArea(InfoAreaLog); this->selectArea(InfoAreaLog);
} }
void CMainInfoAreaComponent::selectLog()
{
this->selectArea(InfoAreaLog);
}
QSize CMainInfoAreaComponent::getPreferredSizeWhenFloating(int areaIndex) const QSize CMainInfoAreaComponent::getPreferredSizeWhenFloating(int areaIndex) const
{ {
InfoArea area = static_cast<InfoArea>(areaIndex); InfoArea area = static_cast<InfoArea>(areaIndex);

View File

@@ -109,6 +109,9 @@ namespace BlackGui
//! Select area //! Select area
void selectArea(InfoArea infoArea) { CInfoArea::selectArea(static_cast<int>(infoArea)); } void selectArea(InfoArea infoArea) { CInfoArea::selectArea(static_cast<int>(infoArea)); }
//! Select log
void selectLog();
//! Select settings with given area //! Select settings with given area
void selectSettingsTab(int index); void selectSettingsTab(int index);