refs #485, moved central GUI functionality to sGui

* allow to send status message to main window (from everywhere)
* Use sGui::changedStylesheet where possible
* message when model is stashed
* improved application startup
This commit is contained in:
Klaus Basan
2016-03-13 18:14:19 +00:00
committed by Mathew Sutcliffe
parent b1353cefd4
commit fb046ae1fb
24 changed files with 181 additions and 36 deletions

View File

@@ -10,6 +10,7 @@
#include "dblogincomponent.h"
#include "ui_dblogincomponent.h"
#include "blackgui/overlaymessagesframe.h"
#include "blackmisc/verify.h"
#include "blackmisc/network/url.h"
#include "blackmisc/logmessage.h"
@@ -41,7 +42,7 @@ namespace BlackGui
{
if (msgs.isEmpty()) { return; }
COverlayMessagesFrame *mf = qobject_cast<COverlayMessagesFrame *>(parentWidget());
Q_ASSERT_X(mf, Q_FUNC_INFO, "No overlay widget");
BLACK_VERIFY_X(mf, Q_FUNC_INFO, "No overlay widget");
if (!mf) { return; }
mf->showOverlayMessages(msgs);
}

View File

@@ -40,7 +40,7 @@ namespace BlackGui
this->ui->tvp_AircraftModel->menuRemoveItems(CAircraftModelView::MenuHighlightStashed); // not supported here
connect(this->ui->tvp_AircraftModel, &CAircraftModelView::requestNewBackendData, this, &CDbModelComponent::ps_reload);
connect(this->ui->tvp_AircraftModel, &CAircraftModelView::requestStash, this, &CDbModelComponent::requestStash);
connect(&CStyleSheetUtility::instance(), &CStyleSheetUtility::styleSheetsChanged, this, &CDbModelComponent::ps_onStyleSheetChanged);
connect(sGui, &CGuiApplication::styleSheetsChanged, this, &CDbModelComponent::ps_onStyleSheetChanged);
// configure view
this->ui->tvp_AircraftModel->setFilterWidget(this->ui->filter_AircraftModelFilter);

View File

@@ -80,9 +80,8 @@ namespace BlackGui
CStatusMessage CDbStashComponent::stashModel(const CAircraftModel &model, bool replace)
{
CAircraftModel stashModel(this->consolidateModel(model));
CStatusMessage m(validateStashModel(stashModel, replace));
const CAircraftModel stashModel(this->consolidateModel(model));
const CStatusMessage m(validateStashModel(stashModel, replace));
if (!m.isWarningOrAbove())
{
if (replace)

View File

@@ -10,6 +10,7 @@
#include "navigatordialog.h"
#include "ui_navigatordialog.h"
#include "blackgui/guiutility.h"
#include "blackgui/guiapplication.h"
#include "blackgui/stylesheetutility.h"
#include <QToolButton>
#include <QGridLayout>
@@ -36,7 +37,7 @@ namespace BlackGui
this->setContextMenuPolicy(Qt::CustomContextMenu);
connect(this, &CNavigatorDialog::customContextMenuRequested, this, &CNavigatorDialog::ps_showContextMenu);
connect(&CStyleSheetUtility::instance(), &CStyleSheetUtility::styleSheetsChanged, this, &CNavigatorDialog::ps_onStyleSheetsChanged);
connect(sGui, &CGuiApplication::styleSheetsChanged, this, &CNavigatorDialog::ps_onStyleSheetsChanged);
this->ps_onStyleSheetsChanged();
}

View File

@@ -33,6 +33,8 @@ namespace BlackGui
void CRegisterComponent::ps_update()
{
if (!sGui) { return; }
Q_ASSERT_X(sGui->supportsContexts(), Q_FUNC_INFO, "Application does not support contexts");
this->ui->tvp_RegisteredComponents->updateContainer(sGui->getIContextApplication()->getRegisteredApplications());
}
} // ns