Refactored StreamFileFormat and subclasses' methods to be consistent with SessionFileFormat
This commit is contained in:
parent
ff066ea657
commit
6cc7231e7f
@ -583,12 +583,12 @@ bool Port::openStreams(QString fileName, bool append, QString &error)
|
||||
connect(fmt, SIGNAL(progress(int)), &progress, SLOT(setValue(int)));
|
||||
connect(&progress, SIGNAL(canceled()), fmt, SLOT(cancel()));
|
||||
|
||||
fmt->openStreamsOffline(fileName, streams, error);
|
||||
qDebug("after open offline");
|
||||
fmt->openAsync(fileName, streams, error);
|
||||
qDebug("after open async");
|
||||
|
||||
while (!fmt->isFinished())
|
||||
qApp->processEvents();
|
||||
qDebug("wait over for offline operation");
|
||||
qDebug("wait over for async operation");
|
||||
|
||||
if (!fmt->result())
|
||||
goto _fail;
|
||||
@ -676,12 +676,12 @@ bool Port::saveStreams(QString fileName, QString fileType, QString &error)
|
||||
qApp->processEvents();
|
||||
}
|
||||
|
||||
fmt->saveStreamsOffline(streams, fileName, error);
|
||||
qDebug("after save offline");
|
||||
fmt->saveAsync(streams, fileName, error);
|
||||
qDebug("after save async");
|
||||
|
||||
while (!fmt->isFinished())
|
||||
qApp->processEvents();
|
||||
qDebug("wait over for offline operation");
|
||||
qDebug("wait over for async operation");
|
||||
|
||||
ret = fmt->result();
|
||||
goto _exit;
|
||||
|
@ -27,7 +27,7 @@ OstmFileFormat::OstmFileFormat()
|
||||
// Do Nothing!
|
||||
}
|
||||
|
||||
bool OstmFileFormat::openStreams(const QString fileName,
|
||||
bool OstmFileFormat::open(const QString fileName,
|
||||
OstProto::StreamConfigList &streams, QString &error)
|
||||
{
|
||||
OstProto::FileMeta meta;
|
||||
@ -54,7 +54,7 @@ _fail:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OstmFileFormat::saveStreams(const OstProto::StreamConfigList streams,
|
||||
bool OstmFileFormat::save(const OstProto::StreamConfigList streams,
|
||||
const QString fileName, QString &error)
|
||||
{
|
||||
OstProto::FileContent content;
|
||||
|
@ -29,9 +29,9 @@ class OstmFileFormat : public StreamFileFormat, public NativeFileFormat
|
||||
public:
|
||||
OstmFileFormat();
|
||||
|
||||
virtual bool openStreams(const QString fileName,
|
||||
virtual bool open(const QString fileName,
|
||||
OstProto::StreamConfigList &streams, QString &error);
|
||||
virtual bool saveStreams(const OstProto::StreamConfigList streams,
|
||||
virtual bool save(const OstProto::StreamConfigList streams,
|
||||
const QString fileName, QString &error);
|
||||
|
||||
bool isMyFileFormat(const QString fileName);
|
||||
|
@ -91,7 +91,7 @@ PcapFileFormat::~PcapFileFormat()
|
||||
delete importDialog_;
|
||||
}
|
||||
|
||||
bool PcapFileFormat::openStreams(const QString fileName,
|
||||
bool PcapFileFormat::open(const QString fileName,
|
||||
OstProto::StreamConfigList &streams, QString &error)
|
||||
{
|
||||
bool isOk = false;
|
||||
@ -325,7 +325,7 @@ bool PcapFileFormat::openStreams(const QString fileName,
|
||||
goto _diff_fail;
|
||||
}
|
||||
|
||||
if (!saveStreams(streams, importedPcapFile.fileName(), error))
|
||||
if (!save(streams, importedPcapFile.fileName(), error))
|
||||
{
|
||||
error.append("Error saving imported streams as PCAP for diff");
|
||||
goto _diff_fail;
|
||||
@ -553,7 +553,7 @@ bool PcapFileFormat::readPacket(PcapPacketHeader &pktHdr, QByteArray &pktBuf)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PcapFileFormat::saveStreams(const OstProto::StreamConfigList streams,
|
||||
bool PcapFileFormat::save(const OstProto::StreamConfigList streams,
|
||||
const QString fileName, QString &error)
|
||||
{
|
||||
bool isOk = false;
|
||||
|
@ -47,9 +47,9 @@ public:
|
||||
PcapFileFormat();
|
||||
~PcapFileFormat();
|
||||
|
||||
bool openStreams(const QString fileName,
|
||||
bool open(const QString fileName,
|
||||
OstProto::StreamConfigList &streams, QString &error);
|
||||
bool saveStreams(const OstProto::StreamConfigList streams,
|
||||
bool save(const OstProto::StreamConfigList streams,
|
||||
const QString fileName, QString &error);
|
||||
|
||||
virtual QDialog* openOptionsDialog();
|
||||
|
@ -35,7 +35,7 @@ PdmlFileFormat::~PdmlFileFormat()
|
||||
{
|
||||
}
|
||||
|
||||
bool PdmlFileFormat::openStreams(const QString fileName,
|
||||
bool PdmlFileFormat::open(const QString fileName,
|
||||
OstProto::StreamConfigList &streams, QString &error)
|
||||
{
|
||||
bool isOk = false;
|
||||
@ -75,7 +75,7 @@ _exit:
|
||||
return isOk;
|
||||
}
|
||||
|
||||
bool PdmlFileFormat::saveStreams(const OstProto::StreamConfigList streams,
|
||||
bool PdmlFileFormat::save(const OstProto::StreamConfigList streams,
|
||||
const QString fileName, QString &error)
|
||||
{
|
||||
bool isOk = false;
|
||||
@ -97,7 +97,7 @@ bool PdmlFileFormat::saveStreams(const OstProto::StreamConfigList streams,
|
||||
connect(fmt, SIGNAL(progress(int)), this, SIGNAL(progress(int)));
|
||||
|
||||
emit status("Writing intermediate PCAP file...");
|
||||
isOk = fmt->saveStreams(streams, pcapFile.fileName(), error);
|
||||
isOk = fmt->save(streams, pcapFile.fileName(), error);
|
||||
|
||||
qDebug("generating PDML %s", fileName.toAscii().constData());
|
||||
emit status("Converting PCAP to PDML...");
|
||||
|
@ -27,9 +27,9 @@ public:
|
||||
PdmlFileFormat();
|
||||
~PdmlFileFormat();
|
||||
|
||||
virtual bool openStreams(const QString fileName,
|
||||
virtual bool open(const QString fileName,
|
||||
OstProto::StreamConfigList &streams, QString &error);
|
||||
virtual bool saveStreams(const OstProto::StreamConfigList streams,
|
||||
virtual bool save(const OstProto::StreamConfigList streams,
|
||||
const QString fileName, QString &error);
|
||||
|
||||
bool isMyFileFormat(const QString fileName);
|
||||
|
@ -46,14 +46,14 @@ PythonFileFormat::~PythonFileFormat()
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
bool PythonFileFormat::openStreams(const QString /*fileName*/,
|
||||
bool PythonFileFormat::open(const QString /*fileName*/,
|
||||
OstProto::StreamConfigList &/*streams*/, QString &/*error*/)
|
||||
{
|
||||
// NOT SUPPORTED!
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PythonFileFormat::saveStreams(const OstProto::StreamConfigList streams,
|
||||
bool PythonFileFormat::save(const OstProto::StreamConfigList streams,
|
||||
const QString fileName, QString &error)
|
||||
{
|
||||
QFile file(fileName);
|
||||
|
@ -30,9 +30,9 @@ public:
|
||||
PythonFileFormat();
|
||||
~PythonFileFormat();
|
||||
|
||||
virtual bool openStreams(const QString fileName,
|
||||
virtual bool open(const QString fileName,
|
||||
OstProto::StreamConfigList &streams, QString &error);
|
||||
virtual bool saveStreams(const OstProto::StreamConfigList streams,
|
||||
virtual bool save(const OstProto::StreamConfigList streams,
|
||||
const QString fileName, QString &error);
|
||||
|
||||
bool isMyFileFormat(const QString fileName);
|
||||
|
@ -62,7 +62,7 @@ QStringList StreamFileFormat::supportedFileTypes(Operation op)
|
||||
return fileTypes;
|
||||
}
|
||||
|
||||
void StreamFileFormat::openStreamsOffline(const QString fileName,
|
||||
void StreamFileFormat::openAsync(const QString fileName,
|
||||
OstProto::StreamConfigList &streams, QString &error)
|
||||
{
|
||||
fileName_ = fileName;
|
||||
@ -74,7 +74,7 @@ void StreamFileFormat::openStreamsOffline(const QString fileName,
|
||||
start();
|
||||
}
|
||||
|
||||
void StreamFileFormat::saveStreamsOffline(
|
||||
void StreamFileFormat::saveAsync(
|
||||
const OstProto::StreamConfigList streams,
|
||||
const QString fileName, QString &error)
|
||||
{
|
||||
@ -134,7 +134,7 @@ void StreamFileFormat::cancel()
|
||||
void StreamFileFormat::run()
|
||||
{
|
||||
if (op_ == kOpenFile)
|
||||
result_ = openStreams(fileName_, *openStreams_, *error_);
|
||||
result_ = open(fileName_, *openStreams_, *error_);
|
||||
else if (op_ == kSaveFile)
|
||||
result_ = saveStreams(saveStreams_, fileName_, *error_);
|
||||
result_ = save(saveStreams_, fileName_, *error_);
|
||||
}
|
||||
|
@ -36,17 +36,17 @@ public:
|
||||
StreamFileFormat();
|
||||
virtual ~StreamFileFormat();
|
||||
|
||||
virtual bool openStreams(const QString fileName,
|
||||
virtual bool open(const QString fileName,
|
||||
OstProto::StreamConfigList &streams, QString &error) = 0;
|
||||
virtual bool saveStreams(const OstProto::StreamConfigList streams,
|
||||
virtual bool save(const OstProto::StreamConfigList streams,
|
||||
const QString fileName, QString &error) = 0;
|
||||
|
||||
virtual QDialog* openOptionsDialog();
|
||||
virtual QDialog* saveOptionsDialog();
|
||||
|
||||
void openStreamsOffline(const QString fileName,
|
||||
void openAsync(const QString fileName,
|
||||
OstProto::StreamConfigList &streams, QString &error);
|
||||
void saveStreamsOffline(const OstProto::StreamConfigList streams,
|
||||
void saveAsync(const OstProto::StreamConfigList streams,
|
||||
const QString fileName, QString &error);
|
||||
|
||||
bool result();
|
||||
|
Loading…
Reference in New Issue
Block a user