mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
refs #452 details textbox for logs
* details can be displayed en detail * feature can be switched on/off via context menu * signals in view to select message
This commit is contained in:
committed by
Mathew Sutcliffe
parent
6ca0d480d3
commit
25471730e3
@@ -13,17 +13,20 @@
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackGui;
|
||||
using namespace BlackGui::Views;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
|
||||
CLogComponent::CLogComponent(QWidget *parent) :
|
||||
QFrame(parent), ui(new Ui::CLogComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->ui->tvp_StatusMessages->setAutoResizeFrequency(3);
|
||||
connect(this->ui->tvp_StatusMessages, &CStatusMessageView::messageSelected,
|
||||
this->ui->form_StatusMessage, &CStatusMessageForm::setValue);
|
||||
this->ui->tvp_StatusMessages->setCustomMenu(new CLogMenu(this));
|
||||
}
|
||||
|
||||
CLogComponent::~CLogComponent()
|
||||
@@ -45,5 +48,17 @@ namespace BlackGui
|
||||
if (statusMessage.isEmpty()) return;
|
||||
this->ui->tvp_StatusMessages->insert(statusMessage);
|
||||
}
|
||||
|
||||
void CLogComponent::CLogMenu::customMenu(QMenu &menu) const
|
||||
{
|
||||
CLogComponent *logComp = qobject_cast<CLogComponent *>(this->parent());
|
||||
Q_ASSERT_X(logComp, Q_FUNC_INFO, "Missing parent");
|
||||
|
||||
bool v = logComp->ui->form_StatusMessage->isVisible();
|
||||
QString formString(v ? "Hide details" : "Show details");
|
||||
QAction *a = menu.addAction(BlackMisc::CIcons::databaseTable16(), formString, logComp->ui->form_StatusMessage, SLOT(toggleVisibility()));
|
||||
a->setCheckable(true);
|
||||
a->setChecked(v);
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "enableforruntime.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
|
||||
#include "blackgui/menudelegate.h"
|
||||
#include <QFrame>
|
||||
#include <QScopedPointer>
|
||||
|
||||
@@ -25,7 +25,6 @@ namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
|
||||
//! GUI displaying log and status messages
|
||||
class BLACKGUI_EXPORT CLogComponent :
|
||||
public QFrame,
|
||||
@@ -52,7 +51,19 @@ namespace BlackGui
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CLogComponent> ui;
|
||||
|
||||
//! Custom menu for the log component
|
||||
class CLogMenu : public BlackGui::IMenuDelegate
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
CLogMenu(CLogComponent *parent) : IMenuDelegate(parent) {}
|
||||
|
||||
//! \copydoc IMenuDelegate::customMenu
|
||||
virtual void customMenu(QMenu &menu) const override;
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
#endif // guard
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>262</width>
|
||||
<height>313</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
@@ -55,7 +55,7 @@
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="vl_StatusPageMessages">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
@@ -82,6 +82,34 @@
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="BlackGui::CStatusMessageForm" name="form_StatusMessage">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pg_LogConsole">
|
||||
@@ -139,6 +167,12 @@
|
||||
<extends>QTableView</extends>
|
||||
<header>blackgui/views/statusmessageview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::CStatusMessageForm</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/statusmessageform.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
Reference in New Issue
Block a user