mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 10:55:32 +08:00
Improve the performance and usability of the raw FSD message display
* Replaced QListView with QPlainTextEdit * Added filter options for packet type and text * Option to globally disable/enable the feature. Default disabled Maniphest Tasks: Ref T240
This commit is contained in:
committed by
Klaus Basan
parent
58d128a9da
commit
b12002caa2
@@ -160,7 +160,8 @@ namespace BlackCore
|
|||||||
Vat_SetAircraftInfoHandler(m_net.data(), onPilotInfoReceived, this);
|
Vat_SetAircraftInfoHandler(m_net.data(), onPilotInfoReceived, this);
|
||||||
Vat_SetCustomPilotPacketHandler(m_net.data(), onCustomPacketReceived, this);
|
Vat_SetCustomPilotPacketHandler(m_net.data(), onCustomPacketReceived, this);
|
||||||
Vat_SetAircraftConfigHandler(m_net.data(), onAircraftConfigReceived, this);
|
Vat_SetAircraftConfigHandler(m_net.data(), onAircraftConfigReceived, this);
|
||||||
Vat_SetFsdMessageHandler(m_net.data(), onRawFsdMessage, this);
|
|
||||||
|
fsdMessageSettingsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
CNetworkVatlib::~CNetworkVatlib()
|
CNetworkVatlib::~CNetworkVatlib()
|
||||||
@@ -1036,6 +1037,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CNetworkVatlib::handleRawFsdMessage(const QString &fsdMessage)
|
void CNetworkVatlib::handleRawFsdMessage(const QString &fsdMessage)
|
||||||
{
|
{
|
||||||
|
if (!m_rawFsdMessagesEnabled) { return; }
|
||||||
CRawFsdMessage rawFsdMessage(fsdMessage);
|
CRawFsdMessage rawFsdMessage(fsdMessage);
|
||||||
if (m_rawFsdMessageLogFile.isOpen())
|
if (m_rawFsdMessageLogFile.isOpen())
|
||||||
{
|
{
|
||||||
@@ -1045,11 +1047,25 @@ namespace BlackCore
|
|||||||
emit rawFsdMessageReceived(rawFsdMessage);
|
emit rawFsdMessageReceived(rawFsdMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void CNetworkVatlib::fsdMessageSettingsChanged()
|
void CNetworkVatlib::fsdMessageSettingsChanged()
|
||||||
{
|
{
|
||||||
|
if (!m_net) { return; }
|
||||||
if (m_rawFsdMessageLogFile.isOpen()) { m_rawFsdMessageLogFile.close(); }
|
if (m_rawFsdMessageLogFile.isOpen()) { m_rawFsdMessageLogFile.close(); }
|
||||||
const CRawFsdMessageSettings setting = m_fsdMessageSetting.get();
|
const CRawFsdMessageSettings setting = m_fsdMessageSetting.get();
|
||||||
if (!setting.isFileWritingEnabled() || setting.getFileDir().isEmpty()) { return; }
|
|
||||||
|
// Workaround bug in vatlib v0.9.7. Handlers cannot be updated.
|
||||||
|
m_rawFsdMessagesEnabled = setting.areRawFsdMessagesEnabled();
|
||||||
|
/*if (!setting.areRawFsdMessagesEnabled())
|
||||||
|
{
|
||||||
|
Vat_SetFsdMessageHandler(m_net.data(), nullptr, this);
|
||||||
|
return;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
Vat_SetFsdMessageHandler(m_net.data(), CNetworkVatlib::onRawFsdMessage, this);
|
||||||
|
|
||||||
|
if (setting.getFileWriteMode() == CRawFsdMessageSettings::None || setting.getFileDir().isEmpty()) { return; }
|
||||||
|
|
||||||
if (setting.getFileWriteMode() == CRawFsdMessageSettings::Truncate)
|
if (setting.getFileWriteMode() == CRawFsdMessageSettings::Truncate)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -260,6 +260,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
BlackMisc::CSettingReadOnly<BlackCore::Vatsim::TRawFsdMessageSetting> m_fsdMessageSetting { this, &CNetworkVatlib::fsdMessageSettingsChanged };
|
BlackMisc::CSettingReadOnly<BlackCore::Vatsim::TRawFsdMessageSetting> m_fsdMessageSetting { this, &CNetworkVatlib::fsdMessageSettingsChanged };
|
||||||
QFile m_rawFsdMessageLogFile;
|
QFile m_rawFsdMessageLogFile;
|
||||||
|
bool m_rawFsdMessagesEnabled = false;
|
||||||
};
|
};
|
||||||
} //namespace
|
} //namespace
|
||||||
} //namespace
|
} //namespace
|
||||||
|
|||||||
@@ -79,14 +79,14 @@ namespace BlackCore
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
CRawFsdMessageSettings::CRawFsdMessageSettings(bool enabled, const QString &FileDir) :
|
CRawFsdMessageSettings::CRawFsdMessageSettings(bool enabled, const QString &FileDir) :
|
||||||
m_fileWritingEnabled(enabled), m_FileDir(FileDir)
|
m_rawFsdMessagesEnabled(enabled), m_FileDir(FileDir)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
QString CRawFsdMessageSettings::convertToQString(bool i18n) const
|
QString CRawFsdMessageSettings::convertToQString(bool i18n) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(i18n);
|
Q_UNUSED(i18n);
|
||||||
QString s("CRawFsdMessageSettings");
|
QString s("CRawFsdMessageSettings");
|
||||||
s.append(" enabled: ").append(boolToYesNo(m_fileWritingEnabled));
|
s.append(" enabled: ").append(boolToYesNo(m_rawFsdMessagesEnabled));
|
||||||
s.append(" dir: ").append(m_FileDir);
|
s.append(" dir: ").append(m_FileDir);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ namespace BlackCore
|
|||||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexWriteEnabled: return CVariant::fromValue(this->m_fileWritingEnabled);
|
case IndexRawFsdMessagesEnabled: return CVariant::fromValue(this->m_rawFsdMessagesEnabled);
|
||||||
case IndexFileDir: return CVariant::fromValue(this->m_FileDir);
|
case IndexFileDir: return CVariant::fromValue(this->m_FileDir);
|
||||||
case IndexFileWriteMode: return CVariant::fromValue(this->m_fileWriteMode);
|
case IndexFileWriteMode: return CVariant::fromValue(this->m_fileWriteMode);
|
||||||
default: return CValueObject::propertyByIndex(index);
|
default: return CValueObject::propertyByIndex(index);
|
||||||
@@ -110,7 +110,7 @@ namespace BlackCore
|
|||||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexWriteEnabled: this->m_fileWritingEnabled = variant.toBool(); break;
|
case IndexRawFsdMessagesEnabled: this->m_rawFsdMessagesEnabled = variant.toBool(); break;
|
||||||
case IndexFileDir: this->m_FileDir = variant.toQString(); break;
|
case IndexFileDir: this->m_FileDir = variant.toQString(); break;
|
||||||
case IndexFileWriteMode: this->m_fileWriteMode = variant.to<FileWriteMode>(); break;
|
case IndexFileWriteMode: this->m_fileWriteMode = variant.to<FileWriteMode>(); break;
|
||||||
default: CValueObject::setPropertyByIndex(index, variant); break;
|
default: CValueObject::setPropertyByIndex(index, variant); break;
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ namespace BlackCore
|
|||||||
//! File writing mode
|
//! File writing mode
|
||||||
enum FileWriteMode
|
enum FileWriteMode
|
||||||
{
|
{
|
||||||
|
None,
|
||||||
Truncate,
|
Truncate,
|
||||||
Append,
|
Append,
|
||||||
Timestamped
|
Timestamped
|
||||||
@@ -182,7 +183,7 @@ namespace BlackCore
|
|||||||
//! Properties by index
|
//! Properties by index
|
||||||
enum ColumnIndex
|
enum ColumnIndex
|
||||||
{
|
{
|
||||||
IndexWriteEnabled = BlackMisc::CPropertyIndex::GlobalIndexRawFsdMessageSettings,
|
IndexRawFsdMessagesEnabled = BlackMisc::CPropertyIndex::GlobalIndexRawFsdMessageSettings,
|
||||||
IndexFileDir,
|
IndexFileDir,
|
||||||
IndexFileWriteMode
|
IndexFileWriteMode
|
||||||
};
|
};
|
||||||
@@ -193,8 +194,8 @@ namespace BlackCore
|
|||||||
//! Simplified constructor
|
//! Simplified constructor
|
||||||
CRawFsdMessageSettings(bool enabled, const QString &fileDir);
|
CRawFsdMessageSettings(bool enabled, const QString &fileDir);
|
||||||
|
|
||||||
//! Is file writing enabled?
|
//! Are raw FSD messages enabled?
|
||||||
bool isFileWritingEnabled() const { return m_fileWritingEnabled; }
|
bool areRawFsdMessagesEnabled() const { return m_rawFsdMessagesEnabled; }
|
||||||
|
|
||||||
//! Get file directory
|
//! Get file directory
|
||||||
QString getFileDir() const { return m_FileDir; }
|
QString getFileDir() const { return m_FileDir; }
|
||||||
@@ -212,13 +213,13 @@ namespace BlackCore
|
|||||||
QString convertToQString(bool i18n = false) const;
|
QString convertToQString(bool i18n = false) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_fileWritingEnabled = false;
|
bool m_rawFsdMessagesEnabled = false;
|
||||||
QString m_FileDir;
|
QString m_FileDir;
|
||||||
FileWriteMode m_fileWriteMode = Truncate;
|
FileWriteMode m_fileWriteMode = None;
|
||||||
|
|
||||||
BLACK_METACLASS(
|
BLACK_METACLASS(
|
||||||
CRawFsdMessageSettings,
|
CRawFsdMessageSettings,
|
||||||
BLACK_METAMEMBER(fileWritingEnabled),
|
BLACK_METAMEMBER(rawFsdMessagesEnabled),
|
||||||
BLACK_METAMEMBER(FileDir),
|
BLACK_METAMEMBER(FileDir),
|
||||||
BLACK_METAMEMBER(fileWriteMode)
|
BLACK_METAMEMBER(fileWriteMode)
|
||||||
);
|
);
|
||||||
@@ -233,12 +234,12 @@ namespace BlackCore
|
|||||||
//! \copydoc BlackCore::TSettingTrait::humanReadable
|
//! \copydoc BlackCore::TSettingTrait::humanReadable
|
||||||
static const QString &humanReadable() { static const QString name("FSD message Logging"); return name; }
|
static const QString &humanReadable() { static const QString name("FSD message Logging"); return name; }
|
||||||
|
|
||||||
//! \copydoc BlackCore::TSettingTrait::isValid
|
/* //! \copydoc BlackCore::TSettingTrait::isValid
|
||||||
static bool isValid(const CRawFsdMessageSettings &setting)
|
static bool isValid(const CRawFsdMessageSettings &setting)
|
||||||
{
|
{
|
||||||
if (setting.isFileWritingEnabled()) { return !setting.getFileDir().isEmpty(); }
|
if (setting.areRawFsdMessagesEnabled()) { return !setting.getFileDir().isEmpty(); }
|
||||||
return true;
|
return true;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
//! \copydoc BlackCore::TSettingTrait::defaultValue
|
//! \copydoc BlackCore::TSettingTrait::defaultValue
|
||||||
static const CRawFsdMessageSettings &defaultValue()
|
static const CRawFsdMessageSettings &defaultValue()
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QStringList>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
@@ -30,37 +31,145 @@ namespace BlackGui
|
|||||||
QFrame(parent), ui(new Ui::CRawFsdMessagesComponent)
|
QFrame(parent), ui(new Ui::CRawFsdMessagesComponent)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
ui->cb_FileWritingMode->addItem(QApplication::translate("CRawFsdMessagesComponent", "None", nullptr), QVariant::fromValue(CRawFsdMessageSettings::None));
|
||||||
ui->cb_FileWritingMode->addItem(QApplication::translate("CRawFsdMessagesComponent", "Truncate", nullptr), QVariant::fromValue(CRawFsdMessageSettings::Truncate));
|
ui->cb_FileWritingMode->addItem(QApplication::translate("CRawFsdMessagesComponent", "Truncate", nullptr), QVariant::fromValue(CRawFsdMessageSettings::Truncate));
|
||||||
ui->cb_FileWritingMode->addItem(QApplication::translate("CRawFsdMessagesComponent", "Append", nullptr), QVariant::fromValue(CRawFsdMessageSettings::Append));
|
ui->cb_FileWritingMode->addItem(QApplication::translate("CRawFsdMessagesComponent", "Append", nullptr), QVariant::fromValue(CRawFsdMessageSettings::Append));
|
||||||
ui->cb_FileWritingMode->addItem(QApplication::translate("CRawFsdMessagesComponent", "Timestamped", nullptr), QVariant::fromValue(CRawFsdMessageSettings::Timestamped));
|
ui->cb_FileWritingMode->addItem(QApplication::translate("CRawFsdMessagesComponent", "Timestamped", nullptr), QVariant::fromValue(CRawFsdMessageSettings::Timestamped));
|
||||||
|
|
||||||
QMetaObject::Connection c = sGui->getIContextNetwork()->connectRawFsdMessageSignal(this, std::bind(&CRawFsdMessagesComponent::addFsdMessage, this, std::placeholders::_1));
|
ui->cb_FilterPacketType->addItem("");
|
||||||
if (!c)
|
ui->cb_FilterPacketType->addItems(CRawFsdMessage::getAllPacketTypes());
|
||||||
{
|
ui->pte_RawFsdMessages->setMaximumBlockCount(m_maxDisplayedMessages);
|
||||||
ui->cb_EnableFileWriting->setEnabled(false);
|
ui->le_MaxDisplayedMessages->setText(QString::number(m_maxDisplayedMessages));
|
||||||
ui->lw_RawFsdMessages->addItem(QStringLiteral("Could not connect to raw FSD message."));
|
|
||||||
ui->lw_RawFsdMessages->addItem(QStringLiteral("This is most likely because core is not running in this process."));
|
setupConnections();
|
||||||
ui->lw_RawFsdMessages->addItem(QStringLiteral("Open this component again from the process running core."));
|
expandFilters(false);
|
||||||
}
|
expandWritingToFile(false);
|
||||||
else
|
|
||||||
{
|
|
||||||
m_signalConnections.append(c);
|
|
||||||
readSettings();
|
|
||||||
connect(ui->cb_EnableFileWriting, &QCheckBox::toggled, this, &CRawFsdMessagesComponent::changeWritingToFile);
|
|
||||||
connect(ui->pb_SelectFileDir, &QPushButton::clicked, this, &CRawFsdMessagesComponent::selectFileDir);
|
|
||||||
connect(ui->cb_FileWritingMode, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &CRawFsdMessagesComponent::changeFileWritingMode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CRawFsdMessagesComponent::~CRawFsdMessagesComponent()
|
CRawFsdMessagesComponent::~CRawFsdMessagesComponent()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void CRawFsdMessagesComponent::changeWritingToFile(bool enable)
|
void CRawFsdMessagesComponent::setupConnections()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
connect(ui->le_FilterText, &QLineEdit::returnPressed, this, &CRawFsdMessagesComponent::changeStringFilter);
|
||||||
|
connect(ui->cb_FilterPacketType, &QComboBox::currentTextChanged, this, &CRawFsdMessagesComponent::changePacketTypeFilter);
|
||||||
|
connect(ui->gb_Filter, &QGroupBox::toggled, this, &CRawFsdMessagesComponent::expandFilters);
|
||||||
|
connect(ui->gb_WriteToFile , &QGroupBox::toggled, this, &CRawFsdMessagesComponent::expandWritingToFile);
|
||||||
|
connect(ui->pb_SelectFileDir, &QPushButton::clicked, this, &CRawFsdMessagesComponent::selectFileDir);
|
||||||
|
connect(ui->le_MaxDisplayedMessages, &QLineEdit::returnPressed, this, &CRawFsdMessagesComponent::changeMaxDisplayedMessages);
|
||||||
|
|
||||||
|
QValidator *validator = new QIntValidator(10, 200, this);
|
||||||
|
ui->le_MaxDisplayedMessages->setValidator(validator);
|
||||||
|
|
||||||
|
using namespace std::placeholders;
|
||||||
|
QMetaObject::Connection c = sGui->getIContextNetwork()->connectRawFsdMessageSignal(this, std::bind(&CRawFsdMessagesComponent::addFsdMessage, this, _1));
|
||||||
|
if (!c)
|
||||||
|
{
|
||||||
|
ui->pte_RawFsdMessages->appendPlainText(QStringLiteral("Could not connect to raw FSD message."));
|
||||||
|
ui->pte_RawFsdMessages->appendPlainText(QStringLiteral("This is most likely because core is not running in this process."));
|
||||||
|
ui->pte_RawFsdMessages->appendPlainText(QStringLiteral("Open this component again from the process running core."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_signalConnections.append(c);
|
||||||
|
|
||||||
|
readSettings();
|
||||||
|
// Connect them after settings are read. Otherwise they get called.
|
||||||
|
connect(ui->cb_FileWritingMode, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &CRawFsdMessagesComponent::changeFileWritingMode);
|
||||||
|
connect(ui->cb_EnableRawFsdMessages, &QCheckBox::toggled, this, &CRawFsdMessagesComponent::enableRawFsdMessages);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRawFsdMessagesComponent::enableRawFsdMessages(bool enable)
|
||||||
|
{
|
||||||
|
ui->cb_FilterPacketType->setEnabled(enable);
|
||||||
|
ui->le_FilterText->setEnabled(enable);
|
||||||
|
ui->le_MaxDisplayedMessages->setEnabled(enable);
|
||||||
ui->le_FileDir->setEnabled(enable);
|
ui->le_FileDir->setEnabled(enable);
|
||||||
ui->pb_SelectFileDir->setEnabled(enable);
|
ui->pb_SelectFileDir->setEnabled(enable);
|
||||||
ui->cb_FileWritingMode->setEnabled(enable);
|
ui->cb_FileWritingMode->setEnabled(enable);
|
||||||
m_setting.setProperty(Vatsim::CRawFsdMessageSettings::IndexWriteEnabled, CVariant::fromValue(enable));
|
m_setting.setProperty(Vatsim::CRawFsdMessageSettings::IndexRawFsdMessagesEnabled, CVariant::fromValue(enable));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRawFsdMessagesComponent::expandFilters(bool expand)
|
||||||
|
{
|
||||||
|
if(expand)
|
||||||
|
{
|
||||||
|
ui->gl_Filters->setHorizontalSpacing(7);
|
||||||
|
ui->gl_Filters->setVerticalSpacing(7);
|
||||||
|
ui->gl_Filters->setContentsMargins(11, 11, 11, 11);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->gl_Filters->setHorizontalSpacing(0);
|
||||||
|
ui->gl_Filters->setVerticalSpacing(0);
|
||||||
|
ui->gl_Filters->setContentsMargins(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int idx = 0; idx < ui->gl_Filters->count(); idx++)
|
||||||
|
{
|
||||||
|
QLayoutItem * const item = ui->gl_Filters->itemAt(idx);
|
||||||
|
if(item->widget()) { item->widget()->setVisible(expand); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRawFsdMessagesComponent::expandWritingToFile(bool expand)
|
||||||
|
{
|
||||||
|
if(expand)
|
||||||
|
{
|
||||||
|
ui->gl_WriteToFile->setHorizontalSpacing(7);
|
||||||
|
ui->gl_WriteToFile->setVerticalSpacing(7);
|
||||||
|
ui->gl_WriteToFile->setContentsMargins(11, 11, 11, 11);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->gl_WriteToFile->setHorizontalSpacing(0);
|
||||||
|
ui->gl_WriteToFile->setVerticalSpacing(0);
|
||||||
|
ui->gl_WriteToFile->setContentsMargins(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int idx = 0; idx < ui->gl_WriteToFile->count(); idx++)
|
||||||
|
{
|
||||||
|
QLayoutItem * const item = ui->gl_WriteToFile->itemAt(idx);
|
||||||
|
if(item->widget()) { item->widget()->setVisible(expand); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRawFsdMessagesComponent::changeStringFilter()
|
||||||
|
{
|
||||||
|
m_filterString = ui->le_FilterText->text();
|
||||||
|
filterDisplayedMessages();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRawFsdMessagesComponent::changePacketTypeFilter(const QString &type)
|
||||||
|
{
|
||||||
|
m_filterPacketType = type;
|
||||||
|
filterDisplayedMessages();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRawFsdMessagesComponent::changeMaxDisplayedMessages()
|
||||||
|
{
|
||||||
|
int maxDisplayedMessages = 0;
|
||||||
|
bool ok = false;
|
||||||
|
maxDisplayedMessages = ui->le_MaxDisplayedMessages->text().toInt(&ok);
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
m_maxDisplayedMessages = maxDisplayedMessages;
|
||||||
|
filterDisplayedMessages();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRawFsdMessagesComponent::filterDisplayedMessages()
|
||||||
|
{
|
||||||
|
CRawFsdMessageList filtered = m_buffer;
|
||||||
|
if (! m_filterString.isEmpty()) { filtered = filtered.findByContainsString(m_filterString); }
|
||||||
|
if (! m_filterPacketType.isEmpty()) { filtered = filtered.findByPacketType(m_filterPacketType); }
|
||||||
|
ui->pte_RawFsdMessages->clear();
|
||||||
|
// Append only the last messages up to maximum display size. Erase everything before.
|
||||||
|
filtered.erase(filtered.begin(), filtered.end() - std::min(filtered.size(), m_maxDisplayedMessages));
|
||||||
|
for (const CRawFsdMessage &rawFsdMessage : filtered)
|
||||||
|
{
|
||||||
|
ui->pte_RawFsdMessages->appendPlainText(rawFsdMessageToString(rawFsdMessage));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRawFsdMessagesComponent::selectFileDir()
|
void CRawFsdMessagesComponent::selectFileDir()
|
||||||
@@ -74,38 +183,39 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CRawFsdMessagesComponent::changeFileWritingMode()
|
void CRawFsdMessagesComponent::changeFileWritingMode()
|
||||||
{
|
{
|
||||||
CRawFsdMessageSettings::FileWriteMode mode = ui->cb_FileWritingMode->currentData().value<CRawFsdMessageSettings::FileWriteMode>();
|
const CRawFsdMessageSettings::FileWriteMode mode = ui->cb_FileWritingMode->currentData().value<CRawFsdMessageSettings::FileWriteMode>();
|
||||||
m_setting.setProperty(Vatsim::CRawFsdMessageSettings::IndexFileWriteMode, CVariant::fromValue(mode));
|
m_setting.setProperty(Vatsim::CRawFsdMessageSettings::IndexFileWriteMode, CVariant::fromValue(mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRawFsdMessagesComponent::setFileWritingModeFromSettings(CRawFsdMessageSettings::FileWriteMode mode)
|
|
||||||
{
|
|
||||||
ui->cb_FileWritingMode->setCurrentIndex(static_cast<int>(mode));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CRawFsdMessagesComponent::addFsdMessage(const CRawFsdMessage &rawFsdMessage)
|
void CRawFsdMessagesComponent::addFsdMessage(const CRawFsdMessage &rawFsdMessage)
|
||||||
{
|
{
|
||||||
ui->lw_RawFsdMessages->addItem(rawFsdMessage.toQString());
|
if (m_buffer.size() == m_maxDisplayedMessages) { m_buffer.pop_front(); }
|
||||||
ui->lw_RawFsdMessages->scrollToBottom();
|
m_buffer.push_back(rawFsdMessage.getRawMessage());
|
||||||
|
|
||||||
while (ui->lw_RawFsdMessages->count() > 100)
|
if (! m_filterPacketType.isEmpty() && ! rawFsdMessage.isPacketType(m_filterPacketType)) { return; }
|
||||||
{
|
if (! m_filterString.isEmpty() && ! rawFsdMessage.containsString(m_filterString)) { return; }
|
||||||
QListWidgetItem *item = ui->lw_RawFsdMessages->takeItem(0);
|
ui->pte_RawFsdMessages->appendPlainText(rawFsdMessageToString(rawFsdMessage));
|
||||||
delete item;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRawFsdMessagesComponent::readSettings()
|
void CRawFsdMessagesComponent::readSettings()
|
||||||
{
|
{
|
||||||
const Vatsim::CRawFsdMessageSettings setting = m_setting.get();
|
const Vatsim::CRawFsdMessageSettings setting = m_setting.get();
|
||||||
ui->le_FileDir->setText(setting.getFileDir());
|
const bool enable = setting.areRawFsdMessagesEnabled();
|
||||||
const bool enable = setting.isFileWritingEnabled();
|
ui->cb_EnableRawFsdMessages->setChecked(enable);
|
||||||
ui->cb_EnableFileWriting->setChecked(enable);
|
ui->cb_FilterPacketType->setEnabled(enable);
|
||||||
|
ui->le_FilterText->setEnabled(enable);
|
||||||
|
ui->le_MaxDisplayedMessages->setEnabled(enable);
|
||||||
ui->le_FileDir->setEnabled(enable);
|
ui->le_FileDir->setEnabled(enable);
|
||||||
|
ui->le_FileDir->setText(setting.getFileDir());
|
||||||
ui->pb_SelectFileDir->setEnabled(enable);
|
ui->pb_SelectFileDir->setEnabled(enable);
|
||||||
ui->cb_FileWritingMode->setEnabled(enable);
|
ui->cb_FileWritingMode->setEnabled(enable);
|
||||||
const CRawFsdMessageSettings::FileWriteMode mode = setting.getFileWriteMode();
|
const CRawFsdMessageSettings::FileWriteMode mode = setting.getFileWriteMode();
|
||||||
ui->cb_FileWritingMode->setCurrentIndex(static_cast<int>(mode));
|
ui->cb_FileWritingMode->setCurrentIndex(static_cast<int>(mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CRawFsdMessagesComponent::rawFsdMessageToString(const BlackMisc::Network::CRawFsdMessage &rawFsdMessage)
|
||||||
|
{
|
||||||
|
return QString("%1 %2").arg(rawFsdMessage.getReceptionTime().toString("HH:mm:ss"), rawFsdMessage.getRawMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -14,15 +14,11 @@
|
|||||||
|
|
||||||
#include "blackgui/blackguiexport.h"
|
#include "blackgui/blackguiexport.h"
|
||||||
#include "blackcore/vatsim/vatsimsettings.h"
|
#include "blackcore/vatsim/vatsimsettings.h"
|
||||||
#include "blackmisc/network/rawfsdmessage.h"
|
#include "blackmisc/network/rawfsdmessagelist.h"
|
||||||
#include "blackmisc/connectionguard.h"
|
#include "blackmisc/connectionguard.h"
|
||||||
|
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
|
|
||||||
class QAction;
|
|
||||||
class QPoint;
|
|
||||||
class QWidget;
|
|
||||||
|
|
||||||
namespace Ui { class CRawFsdMessagesComponent; }
|
namespace Ui { class CRawFsdMessagesComponent; }
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
{
|
{
|
||||||
@@ -41,17 +37,33 @@ namespace BlackGui
|
|||||||
virtual ~CRawFsdMessagesComponent();
|
virtual ~CRawFsdMessagesComponent();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void changeWritingToFile(bool enable);
|
void setupConnections();
|
||||||
|
void enableRawFsdMessages(bool enable);
|
||||||
|
void expandFilters(bool expand);
|
||||||
|
void expandWritingToFile(bool expand);
|
||||||
|
void changeStringFilter();
|
||||||
|
void changePacketTypeFilter(const QString &type);
|
||||||
|
void changeMaxDisplayedMessages();
|
||||||
|
void filterDisplayedMessages();
|
||||||
void selectFileDir();
|
void selectFileDir();
|
||||||
void changeFileWritingMode();
|
void changeFileWritingMode();
|
||||||
void setFileWritingModeFromSettings(BlackCore::Vatsim::CRawFsdMessageSettings::FileWriteMode mode);
|
|
||||||
void addFsdMessage(const BlackMisc::Network::CRawFsdMessage &rawFsdMessage);
|
void addFsdMessage(const BlackMisc::Network::CRawFsdMessage &rawFsdMessage);
|
||||||
void readSettings();
|
void readSettings();
|
||||||
|
|
||||||
|
static QString rawFsdMessageToString(const BlackMisc::Network::CRawFsdMessage &rawFsdMessage);
|
||||||
|
|
||||||
BlackMisc::CSetting<BlackCore::Vatsim::TRawFsdMessageSetting> m_setting { this };
|
BlackMisc::CSetting<BlackCore::Vatsim::TRawFsdMessageSetting> m_setting { this };
|
||||||
|
|
||||||
QScopedPointer<Ui::CRawFsdMessagesComponent> ui;
|
QScopedPointer<Ui::CRawFsdMessagesComponent> ui;
|
||||||
BlackMisc::CConnectionGuard m_signalConnections; //!< connected signal/slots
|
BlackMisc::CConnectionGuard m_signalConnections; //!< connected signal/slots
|
||||||
|
|
||||||
|
QString m_filterString;
|
||||||
|
QString m_filterPacketType;
|
||||||
|
|
||||||
|
BlackMisc::Network::CRawFsdMessageList m_buffer;
|
||||||
|
|
||||||
|
int m_maxDisplayedMessages = 100;
|
||||||
|
int m_maxBufferSize = 1000;
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>427</width>
|
<width>458</width>
|
||||||
<height>516</height>
|
<height>571</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
<property name="lineWidth">
|
<property name="lineWidth">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout" rowstretch="1,0,0,0">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -35,19 +35,113 @@
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0" alignment="Qt::AlignRight">
|
||||||
<widget class="QListWidget" name="lw_RawFsdMessages">
|
<widget class="QCheckBox" name="cb_EnableRawFsdMessages">
|
||||||
<property name="selectionMode">
|
<property name="text">
|
||||||
<enum>QAbstractItemView::NoSelection</enum>
|
<string>Enable</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
|
<widget class="QPlainTextEdit" name="pte_RawFsdMessages">
|
||||||
|
<property name="lineWrapMode">
|
||||||
|
<enum>QPlainTextEdit::NoWrap</enum>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="maximumBlockCount">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QGroupBox" name="gb_Filter">
|
||||||
|
<property name="title">
|
||||||
|
<string>Filter</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gl_Filters">
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetMinimumSize</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="lbl_FilterText">
|
||||||
|
<property name="text">
|
||||||
|
<string>Text:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QComboBox" name="cb_FilterPacketType">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Packet Type Filter</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="le_FilterText">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Text Filter</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_FilterPacketType">
|
||||||
|
<property name="text">
|
||||||
|
<string>Type:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLineEdit" name="le_MaxDisplayedMessages">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Maximum No. of lines displayed</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QLabel" name="lbl_MaxDisplayedMessages">
|
||||||
|
<property name="text">
|
||||||
|
<string>Max Displayed Messages:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
<widget class="QGroupBox" name="gb_WriteToFile">
|
<widget class="QGroupBox" name="gb_WriteToFile">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Write to File</string>
|
<string>Write to File</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gl_WriteToFile">
|
||||||
<item row="4" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="lbl_FileDir">
|
<widget class="QLabel" name="lbl_FileDir">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -55,13 +149,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QComboBox" name="cb_FileWritingMode">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="lbl_FileWriteMode">
|
<widget class="QLabel" name="lbl_FileWriteMode">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -69,13 +156,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QCheckBox" name="cb_EnableFileWriting">
|
|
||||||
<property name="text">
|
|
||||||
<string>Enable</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QLineEdit" name="le_FileDir">
|
<widget class="QLineEdit" name="le_FileDir">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
@@ -85,7 +165,7 @@
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="readOnly">
|
<property name="readOnly">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -102,6 +182,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="1" colspan="2">
|
||||||
|
<widget class="QComboBox" name="cb_FileWritingMode">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "blackmisc/network/entityflags.h"
|
#include "blackmisc/network/entityflags.h"
|
||||||
#include "blackmisc/network/fsdsetup.h"
|
#include "blackmisc/network/fsdsetup.h"
|
||||||
#include "blackmisc/network/rawfsdmessage.h"
|
#include "blackmisc/network/rawfsdmessage.h"
|
||||||
|
#include "blackmisc/network/rawfsdmessagelist.h"
|
||||||
#include "blackmisc/network/role.h"
|
#include "blackmisc/network/role.h"
|
||||||
#include "blackmisc/network/rolelist.h"
|
#include "blackmisc/network/rolelist.h"
|
||||||
#include "blackmisc/network/remotefile.h"
|
#include "blackmisc/network/remotefile.h"
|
||||||
|
|||||||
@@ -34,6 +34,24 @@ namespace BlackMisc
|
|||||||
return s.arg(m_receptionTime.toString("dd.MM.yy HH:mm:ss"), m_rawMessage);
|
return s.arg(m_receptionTime.toString("dd.MM.yy HH:mm:ss"), m_rawMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CRawFsdMessage::isPacketType(const QString &type) const
|
||||||
|
{
|
||||||
|
return m_rawMessage.startsWith("FSD Sent=>" + type) || m_rawMessage.startsWith("FSD Recv=>" + type);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRawFsdMessage::containsString(const QString &str) const
|
||||||
|
{
|
||||||
|
return m_rawMessage.contains(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QStringList &CRawFsdMessage::getAllPacketTypes()
|
||||||
|
{
|
||||||
|
static const QStringList allPacketTypes = { "@", "%", "#AA", "#DA", "#AP", "#DP", "#TM", "#WX", "#DL", "#TD", "#WD"
|
||||||
|
"#CD", "#PC", "#SB", "$FP", "$AM", "$PI", "$PO", "$HO", "$HA", "$AX", "$AR",
|
||||||
|
"$CQ", "$CR", "$ER", "$!!" };
|
||||||
|
return allPacketTypes;
|
||||||
|
}
|
||||||
|
|
||||||
CVariant CRawFsdMessage::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
CVariant CRawFsdMessage::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||||
{
|
{
|
||||||
if (index.isMyself()) { return CVariant::from(*this); }
|
if (index.isMyself()) { return CVariant::from(*this); }
|
||||||
|
|||||||
@@ -51,7 +51,16 @@ namespace BlackMisc
|
|||||||
void setRawMessage(const QString &rawMessage) { m_rawMessage = rawMessage; }
|
void setRawMessage(const QString &rawMessage) { m_rawMessage = rawMessage; }
|
||||||
|
|
||||||
//! Get reception time
|
//! Get reception time
|
||||||
QDateTime getReceptionTime() const;
|
const QDateTime &getReceptionTime() const { return m_receptionTime; }
|
||||||
|
|
||||||
|
//! Returns true if the raw message is from the given PDU packet type
|
||||||
|
bool isPacketType(const QString &type) const;
|
||||||
|
|
||||||
|
//! Does the raw message contain str?
|
||||||
|
bool containsString(const QString &str) const;
|
||||||
|
|
||||||
|
//! Returns a list of all known packet types.
|
||||||
|
static const QStringList &getAllPacketTypes ();
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||||
|
|||||||
41
src/blackmisc/network/rawfsdmessagelist.cpp
Normal file
41
src/blackmisc/network/rawfsdmessagelist.cpp
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/* Copyright (C) 2017
|
||||||
|
* swift project Community / Contributors
|
||||||
|
*
|
||||||
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||||
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||||
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||||
|
* contained in the LICENSE file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "rawfsdmessagelist.h"
|
||||||
|
|
||||||
|
namespace BlackMisc
|
||||||
|
{
|
||||||
|
namespace Network
|
||||||
|
{
|
||||||
|
CRawFsdMessageList::CRawFsdMessageList() { }
|
||||||
|
|
||||||
|
CRawFsdMessageList::CRawFsdMessageList(const CSequence &other) : CSequence<CRawFsdMessage>(other)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
CRawFsdMessageList::CRawFsdMessageList(std::initializer_list<CRawFsdMessage> il) :
|
||||||
|
CSequence<CRawFsdMessage>(il)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
CRawFsdMessageList CRawFsdMessageList::findByPacketType(const QString &type) const
|
||||||
|
{
|
||||||
|
return this->findBy([ & ](const CRawFsdMessage &rawFsdMessage)
|
||||||
|
{
|
||||||
|
return rawFsdMessage.isPacketType(type);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
CRawFsdMessageList CRawFsdMessageList::findByContainsString(const QString &str) const
|
||||||
|
{
|
||||||
|
return this->findBy([ & ](const CRawFsdMessage &rawFsdMessage)
|
||||||
|
{
|
||||||
|
return rawFsdMessage.containsString(str);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
} // namespace
|
||||||
57
src/blackmisc/network/rawfsdmessagelist.h
Normal file
57
src/blackmisc/network/rawfsdmessagelist.h
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/* Copyright (C) 2017
|
||||||
|
* swift project Community / Contributors
|
||||||
|
*
|
||||||
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||||
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||||
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||||
|
* contained in the LICENSE file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//! \file
|
||||||
|
|
||||||
|
#ifndef BLACKMISC_NETWORK_RAWFSDMESSAGELIST_H
|
||||||
|
#define BLACKMISC_NETWORK_RAWFSDMESSAGELIST_H
|
||||||
|
|
||||||
|
#include "rawfsdmessage.h"
|
||||||
|
#include "blackmisc/blackmiscexport.h"
|
||||||
|
#include "blackmisc/collection.h"
|
||||||
|
#include "blackmisc/sequence.h"
|
||||||
|
#include "blackmisc/variant.h"
|
||||||
|
#include <QStringList>
|
||||||
|
#include <QMetaType>
|
||||||
|
|
||||||
|
namespace BlackMisc
|
||||||
|
{
|
||||||
|
namespace Network
|
||||||
|
{
|
||||||
|
//! Value object encapsulating a list raw FSD messages.
|
||||||
|
class BLACKMISC_EXPORT CRawFsdMessageList :
|
||||||
|
public CSequence<CRawFsdMessage>,
|
||||||
|
public BlackMisc::Mixin::MetaType<CRawFsdMessageList>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BLACKMISC_DECLARE_USING_MIXIN_METATYPE(CRawFsdMessageList)
|
||||||
|
|
||||||
|
//! Default constructor.
|
||||||
|
CRawFsdMessageList();
|
||||||
|
|
||||||
|
//! Construct from a base class object.
|
||||||
|
CRawFsdMessageList(const CSequence &other);
|
||||||
|
|
||||||
|
//! Construct from initializer list.
|
||||||
|
CRawFsdMessageList(std::initializer_list<CRawFsdMessage> il);
|
||||||
|
|
||||||
|
//! Find by a given list of raw messages which are type
|
||||||
|
CRawFsdMessageList findByPacketType(const QString &type) const;
|
||||||
|
|
||||||
|
//! Find by a given list of models by strings
|
||||||
|
CRawFsdMessageList findByContainsString(const QString &str) const;
|
||||||
|
};
|
||||||
|
} //namespace
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(BlackMisc::Network::CRawFsdMessageList)
|
||||||
|
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackMisc::Network::CRawFsdMessageList>)
|
||||||
|
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::Network::CRawFsdMessageList>)
|
||||||
|
|
||||||
|
#endif //guard
|
||||||
@@ -24,6 +24,7 @@ namespace BlackMisc
|
|||||||
CEntityFlags::registerMetadata();
|
CEntityFlags::registerMetadata();
|
||||||
CFsdSetup::registerMetadata();
|
CFsdSetup::registerMetadata();
|
||||||
CRawFsdMessage::registerMetadata();
|
CRawFsdMessage::registerMetadata();
|
||||||
|
CRawFsdMessageList::registerMetadata();
|
||||||
CRemoteFile::registerMetadata();
|
CRemoteFile::registerMetadata();
|
||||||
CRemoteFileList::registerMetadata();
|
CRemoteFileList::registerMetadata();
|
||||||
CRole::registerMetadata();
|
CRole::registerMetadata();
|
||||||
|
|||||||
Reference in New Issue
Block a user