From 5a03d235cdad32e19ca1dfb8520804647565394c Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 2 Mar 2016 18:54:31 +0100 Subject: [PATCH] refs #608, allow to select log component (attention) when required. This is needed for direct window access to display console messages directly. --- src/blackgui/components/datamaininfoareacomponent.cpp | 6 ++++++ src/blackgui/components/datamaininfoareacomponent.h | 4 ++++ src/blackgui/components/logcomponent.cpp | 6 ++++-- src/blackgui/components/logcomponent.h | 8 ++++++-- src/blackgui/components/maininfoareacomponent.cpp | 10 ++++++++-- src/blackgui/components/maininfoareacomponent.h | 3 +++ 6 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/blackgui/components/datamaininfoareacomponent.cpp b/src/blackgui/components/datamaininfoareacomponent.cpp index 640f89440..0e286dc0f 100644 --- a/src/blackgui/components/datamaininfoareacomponent.cpp +++ b/src/blackgui/components/datamaininfoareacomponent.cpp @@ -37,6 +37,7 @@ namespace BlackGui 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_Log, &CLogComponent::requestAttention, this, &CDataMainInfoAreaComponent::selectLog); } CDataMainInfoAreaComponent::~CDataMainInfoAreaComponent() @@ -69,6 +70,11 @@ namespace BlackGui this->getLogComponent()->displayConsole(); } + void CDataMainInfoAreaComponent::selectLog() + { + this->selectArea(InfoAreaLog); + } + QSize CDataMainInfoAreaComponent::getPreferredSizeWhenFloating(int areaIndex) const { InfoArea area = static_cast(areaIndex); diff --git a/src/blackgui/components/datamaininfoareacomponent.h b/src/blackgui/components/datamaininfoareacomponent.h index cc15b9ed4..f047988e6 100644 --- a/src/blackgui/components/datamaininfoareacomponent.h +++ b/src/blackgui/components/datamaininfoareacomponent.h @@ -68,6 +68,10 @@ namespace BlackGui //! Display console void displayConsole(); + public slots: + //! Select log area + void selectLog(); + protected: //! \copydoc CInfoArea::getPreferredSizeWhenFloating virtual QSize getPreferredSizeWhenFloating(int areaIndex) const override; diff --git a/src/blackgui/components/logcomponent.cpp b/src/blackgui/components/logcomponent.cpp index 6933aa774..e3ffd4e86 100644 --- a/src/blackgui/components/logcomponent.cpp +++ b/src/blackgui/components/logcomponent.cpp @@ -47,14 +47,16 @@ namespace BlackGui CLogComponent::~CLogComponent() { } - void CLogComponent::displayLog() + void CLogComponent::displayLog(bool attention) { this->ui->tw_StatusPage->setCurrentIndex(0); + if(attention) { emit requestAttention(); } } - void CLogComponent::displayConsole() + void CLogComponent::displayConsole(bool attention) { this->ui->tw_StatusPage->setCurrentIndex(1); + if(attention) { emit requestAttention(); } } void CLogComponent::appendStatusMessageToConsole(const CStatusMessage &statusMessage) diff --git a/src/blackgui/components/logcomponent.h b/src/blackgui/components/logcomponent.h index 28d4fffac..9ab1ee619 100644 --- a/src/blackgui/components/logcomponent.h +++ b/src/blackgui/components/logcomponent.h @@ -53,10 +53,14 @@ namespace BlackGui ~CLogComponent(); //! Display log - void displayLog(); + void displayLog(bool attention = false); //! Display console - void displayConsole(); + void displayConsole(bool attention = false); + + signals: + //! Make me visible + void requestAttention(); public slots: //! Append status message to console diff --git a/src/blackgui/components/maininfoareacomponent.cpp b/src/blackgui/components/maininfoareacomponent.cpp index d26127d3d..f8aa173c7 100644 --- a/src/blackgui/components/maininfoareacomponent.cpp +++ b/src/blackgui/components/maininfoareacomponent.cpp @@ -26,8 +26,9 @@ namespace BlackGui ui(new Ui::CMainInfoAreaComponent) { ui->setupUi(this); - initInfoArea(); // init base class - this->setWindowIcon(CIcons::swift24()); + CInfoArea::initInfoArea(); // init base class + this->setWindowIcon(CIcons::swift48()); + connect(this->getLogComponent(), &CLogComponent::requestAttention, this, &CMainInfoAreaComponent::selectLog); } CMainInfoAreaComponent::~CMainInfoAreaComponent() @@ -95,6 +96,11 @@ namespace BlackGui this->selectArea(InfoAreaLog); } + void CMainInfoAreaComponent::selectLog() + { + this->selectArea(InfoAreaLog); + } + QSize CMainInfoAreaComponent::getPreferredSizeWhenFloating(int areaIndex) const { InfoArea area = static_cast(areaIndex); diff --git a/src/blackgui/components/maininfoareacomponent.h b/src/blackgui/components/maininfoareacomponent.h index bb2c4b04e..a164befd8 100644 --- a/src/blackgui/components/maininfoareacomponent.h +++ b/src/blackgui/components/maininfoareacomponent.h @@ -109,6 +109,9 @@ namespace BlackGui //! Select area void selectArea(InfoArea infoArea) { CInfoArea::selectArea(static_cast(infoArea)); } + //! Select log + void selectLog(); + //! Select settings with given area void selectSettingsTab(int index);