Skip to content

Commit

Permalink
refactor: Remove build-in console
Browse files Browse the repository at this point in the history
The console feature was not documented very well and was only used for a
few messages.
  • Loading branch information
ltoenning committed Oct 6, 2024
1 parent 7cdec8e commit c9ef304
Show file tree
Hide file tree
Showing 24 changed files with 12 additions and 203 deletions.
4 changes: 0 additions & 4 deletions src/blackcore/context/contextapplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ namespace BlackCore
//! \note Used for hotkey action, do not use directly
void remoteHotkeyAction(const QString &action, bool argument, const BlackMisc::CIdentifier &origin);

//! Request a message to be displayed on console, whatever the console is
//! \note no guarantee it is really written to console
void requestDisplayOnConsole(const QString &message);

public slots:
//! Ratify some settings changed by another process
//! \note Not pure because it can be called from the base class constructor.
Expand Down
2 changes: 0 additions & 2 deletions src/blackcore/context/contextapplicationproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ namespace BlackCore::Context
s = connection.connect(serviceName, IContextApplication::ObjectPath(), IContextApplication::InterfaceName(),
"remoteHotkeyAction", this, SIGNAL(remoteHotkeyAction(QString, bool, BlackMisc::CIdentifier)));
Q_ASSERT(s);
s = connection.connect(serviceName, IContextApplication::ObjectPath(), IContextApplication::InterfaceName(),
"requestDisplayOnConsole", this, SIGNAL(requestDisplayOnConsole(QString)));
Q_UNUSED(s);
this->relayBaseClassSignals(serviceName, connection, IContextApplication::ObjectPath(), IContextApplication::InterfaceName());
}
Expand Down
3 changes: 0 additions & 3 deletions src/blackcore/context/contextsimulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,6 @@ namespace BlackCore::Context
//! Relevant simulator messages to be explicitly displayed
void driverMessages(const BlackMisc::CStatusMessageList &messages);

//! Request a console message (whatever the console maybe)
void requestUiConsoleMessage(const QString &driverMessage, bool clear);

//! Validated model set
void validatedModelSet(const BlackMisc::Simulation::CSimulatorInfo &simulator,
const BlackMisc::Simulation::CAircraftModelList &valid, const BlackMisc::Simulation::CAircraftModelList &invalid,
Expand Down
10 changes: 0 additions & 10 deletions src/blackcore/context/contextsimulatorimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,6 @@ namespace BlackCore::Context
Q_ASSERT(c);
c = connect(simulator, &ISimulator::driverMessages, this, &IContextSimulator::driverMessages);
Q_ASSERT(c);
c = connect(simulator, &ISimulator::requestUiConsoleMessage, this, &IContextSimulator::requestUiConsoleMessage);
Q_ASSERT(c);
c = connect(simulator, &ISimulator::autoPublishDataWritten, this, &IContextSimulator::autoPublishDataWritten);
Q_ASSERT(c);

Expand Down Expand Up @@ -1074,14 +1072,6 @@ namespace BlackCore::Context
{
CInterpolationAndRenderingSetupGlobal rs = this->getInterpolationAndRenderingSetupGlobal();
const QString p1 = parser.part(1);
if (p1 == "show")
{
if (this->getIContextApplication())
{
emit this->getIContextApplication()->requestDisplayOnConsole(rs.toQString(true));
}
return true;
}
if (!parser.hasPart(2)) { return false; }
const bool on = stringToBool(parser.part(2));
if (p1 == "debug") { rs.setSimulatorDebuggingMessages(on); }
Expand Down
1 change: 0 additions & 1 deletion src/blackcore/context/contextsimulatorimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ namespace BlackCore
{
if (BlackMisc::CSimpleCommandParser::registered("BlackCore::CContextSimulator")) { return; }
BlackMisc::CSimpleCommandParser::registerCommand({ ".ris", "rendering/interpolation setup (global setup)" });
BlackMisc::CSimpleCommandParser::registerCommand({ ".ris show", "display rendering/interpolation setup on console (global setup)" });
BlackMisc::CSimpleCommandParser::registerCommand({ ".ris debug on|off", "rendering/interpolation debug messages (global setup)" });
BlackMisc::CSimpleCommandParser::registerCommand({ ".ris parts on|off", "aircraft parts (global setup)" });
}
Expand Down
3 changes: 0 additions & 3 deletions src/blackcore/context/contextsimulatorproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ namespace BlackCore::Context
"driverMessages", this, SIGNAL(driverMessages(BlackMisc::CStatusMessageList)));

Q_ASSERT(s);
s = connection.connect(serviceName, IContextSimulator::ObjectPath(), IContextSimulator::InterfaceName(),
"requestUiConsoleMessage", this, SIGNAL(requestUiConsoleMessage(QString, bool)));
Q_ASSERT(s);
s = connection.connect(serviceName, IContextSimulator::ObjectPath(), IContextSimulator::InterfaceName(),
"validatedModelSet", this, SIGNAL(validatedModelSet(BlackMisc::Simulation::CSimulatorInfo, BlackMisc::Simulation::CAircraftModelList, BlackMisc::Simulation::CAircraftModelList, bool, BlackMisc::CStatusMessageList)));
Q_ASSERT(s);
Expand Down
1 change: 0 additions & 1 deletion src/blackcore/simulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,6 @@ namespace BlackCore
if (!dm.isEmpty())
{
this->displayStatusMessage(CStatusMessage(this).info(dm));
emit this->requestUiConsoleMessage(dm, true);
}

const int t = CMathUtils::randomInteger(4500, 5500); // makes sure not always using the same time difference
Expand Down
3 changes: 0 additions & 3 deletions src/blackcore/simulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,6 @@ namespace BlackCore
//! Relevant simulator messages to be explicitly displayed
void driverMessages(const BlackMisc::CStatusMessageList &messages);

//! Request a console message (whatever the console maybe)
void requestUiConsoleMessage(const QString &driverMessage, bool clear);

//! Requested elevation, call pending
void requestedElevation(const BlackMisc::Aviation::CCallsign &callsign);

Expand Down
8 changes: 0 additions & 8 deletions src/blackgui/components/datamaininfoareacomponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,6 @@ namespace BlackGui::Components
this->getLogComponent()->displayLog();
}

void CDataMainInfoAreaComponent::displayConsole()
{
this->selectArea(InfoAreaLog);
BLACK_VERIFY_X(this->getLogComponent(), Q_FUNC_INFO, "No log component");
if (!this->getLogComponent()) { return; }
this->getLogComponent()->displayConsole();
}

void CDataMainInfoAreaComponent::selectLog()
{
this->selectArea(InfoAreaLog);
Expand Down
3 changes: 0 additions & 3 deletions src/blackgui/components/datamaininfoareacomponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ namespace BlackGui::Components
//! Display the log
void displayLog();

//! Display console
void displayConsole();

public slots:
//! Select log area
void selectLog();
Expand Down
30 changes: 0 additions & 30 deletions src/blackgui/components/logcomponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ namespace BlackGui::Components
CLogComponent::CLogComponent(QWidget *parent) : QFrame(parent), ui(new Ui::CLogComponent), m_history(this)
{
ui->setupUi(this);
connect(ui->comp_StatusMessages, &CStatusMessagesDetail::modelDataChangedDigest, this, &CLogComponent::onStatusMessageDataChanged);

connect(&m_history, &CLogHistoryReplica::elementAdded, this, [this](const CStatusMessage &message) {
ui->comp_StatusMessages->appendStatusMessageToList(message);
Expand All @@ -66,13 +65,6 @@ namespace BlackGui::Components

void CLogComponent::displayLog(bool attention)
{
ui->tw_StatusPage->setCurrentIndex(0);
if (attention) { emit this->requestAttention(); }
}

void CLogComponent::displayConsole(bool attention)
{
ui->tw_StatusPage->setCurrentIndex(1);
if (attention) { emit this->requestAttention(); }
}

Expand Down Expand Up @@ -118,33 +110,11 @@ namespace BlackGui::Components

void CLogComponent::clear()
{
ui->tep_StatusPageConsole->clear();
ui->comp_StatusMessages->clear();
}

void CLogComponent::clearConsole()
{
ui->tep_StatusPageConsole->clear();
}

void CLogComponent::clearMessages()
{
ui->comp_StatusMessages->clear();
}

void CLogComponent::appendPlainTextToConsole(const QString &text)
{
ui->tep_StatusPageConsole->appendPlainText(text);
}

void CLogComponent::onStatusMessageDataChanged(int count, bool withFilter)
{
Q_UNUSED(count);
Q_UNUSED(withFilter);
const int i = ui->tw_StatusPage->indexOf(ui->pg_LogPage);
QString o = ui->tw_StatusPage->tabText(i);
const QString f = withFilter ? "F" : "";
o = CGuiUtility::replaceTabCountValue(o, ui->comp_StatusMessages->rowCount()) + f;
ui->tw_StatusPage->setTabText(i, o);
}
} // namespace
12 changes: 0 additions & 12 deletions src/blackgui/components/logcomponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ namespace BlackGui::Components
//! Display log
void displayLog(bool attention = false);

//! Display console
void displayConsole(bool attention = false);

//! \copydoc BlackGui::Components::CStatusMessagesDetail::filterUseRadioButtonDescriptiveIcons
void filterUseRadioButtonDescriptiveIcons(bool oneLetterText);

Expand Down Expand Up @@ -85,25 +82,16 @@ namespace BlackGui::Components
//! Clear
void clear();

//! Clear
void clearConsole();

//! Clear
void clearMessages();

//! Append plain text to console
void appendPlainTextToConsole(const QString &text);

signals:
//! Make me visible
void requestAttention();

private:
QScopedPointer<Ui::CLogComponent> ui;
BlackMisc::CLogHistoryReplica m_history;

//! Status messages changed
void onStatusMessageDataChanged(int count, bool withFilter);
};
} // ns
#endif // guard
47 changes: 0 additions & 47 deletions src/blackgui/components/logcomponent.ui
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
<number>0</number>
</property>
<item>
<widget class="QTabWidget" name="tw_StatusPage">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="pg_LogPage">
<attribute name="title">
<string>Log</string>
Expand All @@ -51,49 +47,6 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="pg_LogConsole">
<attribute name="title">
<string>Console</string>
</attribute>
<layout class="QVBoxLayout" name="vl_StatusPageConsole">
<property name="spacing">
<number>4</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="BlackGui::Components::CConsoleTextEdit" name="tep_StatusPageConsole">
<property name="font">
<font>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
</property>
<property name="documentTitle">
<string>Console output</string>
</property>
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
Expand Down
6 changes: 0 additions & 6 deletions src/blackgui/components/maininfoareacomponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,6 @@ namespace BlackGui::Components
this->selectArea(InfoAreaLog);
}

void CMainInfoAreaComponent::displayConsole()
{
ui->comp_Log->displayConsole();
this->selectArea(InfoAreaLog);
}

void CMainInfoAreaComponent::selectArea(CMainInfoAreaComponent::InfoArea infoArea)
{
CInfoArea::selectArea(static_cast<int>(infoArea));
Expand Down
3 changes: 0 additions & 3 deletions src/blackgui/components/maininfoareacomponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ namespace BlackGui::Components
//! Display the log
void displayLog();

//! Display console
void displayConsole();

//! Toggle floating of given area
void toggleFloating(InfoArea infoArea) { CInfoArea::toggleFloatingByIndex(static_cast<int>(infoArea)); }

Expand Down
Loading

0 comments on commit c9ef304

Please sign in to comment.