Renamed AbstractFileFormat to StreamFileFormat and FileFormat to OstmFielFormat to be consistent with the new convention introduced with SessionFileFormat/OssnFileFormat
This commit is contained in:
parent
c8a31f3068
commit
ff066ea657
@ -19,8 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
#include "port.h"
|
||||
|
||||
#include "abstractfileformat.h"
|
||||
#include "emulation.h"
|
||||
#include "streamfileformat.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMainWindow>
|
||||
@ -553,7 +553,7 @@ bool Port::openStreams(QString fileName, bool append, QString &error)
|
||||
QDialog *optDialog;
|
||||
QProgressDialog progress("Opening Streams", "Cancel", 0, 0, mainWindow);
|
||||
OstProto::StreamConfigList streams;
|
||||
AbstractFileFormat *fmt = AbstractFileFormat::fileFormatFromFile(fileName);
|
||||
StreamFileFormat *fmt = StreamFileFormat::fileFormatFromFile(fileName);
|
||||
|
||||
if (fmt == NULL) {
|
||||
error = tr("Unknown streams file format");
|
||||
@ -642,7 +642,7 @@ bool Port::saveStreams(QString fileName, QString fileType, QString &error)
|
||||
{
|
||||
bool ret = false;
|
||||
QProgressDialog progress("Saving Streams", "Cancel", 0, 0, mainWindow);
|
||||
AbstractFileFormat *fmt = AbstractFileFormat::fileFormatFromType(fileType);
|
||||
StreamFileFormat *fmt = StreamFileFormat::fileFormatFromType(fileType);
|
||||
OstProto::StreamConfigList streams;
|
||||
|
||||
if (fmt == NULL)
|
||||
|
@ -19,11 +19,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
#include "portswindow.h"
|
||||
|
||||
#include "abstractfileformat.h"
|
||||
#include "deviceswidget.h"
|
||||
#include "portconfigdialog.h"
|
||||
#include "settings.h"
|
||||
#include "streamconfigdialog.h"
|
||||
#include "streamfileformat.h"
|
||||
#include "streamlistdelegate.h"
|
||||
|
||||
#include "fileformat.pb.h"
|
||||
@ -812,8 +812,8 @@ void PortsWindow::on_actionOpen_Streams_triggered()
|
||||
{
|
||||
qDebug("Open Streams Action");
|
||||
|
||||
QStringList fileTypes = AbstractFileFormat::supportedFileTypes(
|
||||
AbstractFileFormat::kOpenFile);
|
||||
QStringList fileTypes = StreamFileFormat::supportedFileTypes(
|
||||
StreamFileFormat::kOpenFile);
|
||||
QString fileType;
|
||||
QModelIndex current = tvPortList->selectionModel()->currentIndex();
|
||||
static QString dirName;
|
||||
@ -885,8 +885,8 @@ void PortsWindow::on_actionSave_Streams_triggered()
|
||||
|
||||
QModelIndex current = tvPortList->selectionModel()->currentIndex();
|
||||
static QString fileName;
|
||||
QStringList fileTypes = AbstractFileFormat::supportedFileTypes(
|
||||
AbstractFileFormat::kSaveFile);
|
||||
QStringList fileTypes = StreamFileFormat::supportedFileTypes(
|
||||
StreamFileFormat::kSaveFile);
|
||||
QString fileType;
|
||||
QString errorStr;
|
||||
QFileDialog::Options options;
|
||||
|
@ -17,17 +17,17 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include "fileformat.h"
|
||||
#include "ostmfileformat.h"
|
||||
|
||||
FileFormat fileFormat;
|
||||
OstmFileFormat fileFormat;
|
||||
|
||||
FileFormat::FileFormat()
|
||||
: AbstractFileFormat(), NativeFileFormat()
|
||||
OstmFileFormat::OstmFileFormat()
|
||||
: StreamFileFormat(), NativeFileFormat()
|
||||
{
|
||||
// Do Nothing!
|
||||
}
|
||||
|
||||
bool FileFormat::openStreams(const QString fileName,
|
||||
bool OstmFileFormat::openStreams(const QString fileName,
|
||||
OstProto::StreamConfigList &streams, QString &error)
|
||||
{
|
||||
OstProto::FileMeta meta;
|
||||
@ -54,7 +54,7 @@ _fail:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FileFormat::saveStreams(const OstProto::StreamConfigList streams,
|
||||
bool OstmFileFormat::saveStreams(const OstProto::StreamConfigList streams,
|
||||
const QString fileName, QString &error)
|
||||
{
|
||||
OstProto::FileContent content;
|
||||
@ -79,12 +79,12 @@ _fail:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FileFormat::isMyFileFormat(const QString fileName)
|
||||
bool OstmFileFormat::isMyFileFormat(const QString fileName)
|
||||
{
|
||||
return isNativeFileFormat(fileName, OstProto::kStreamsFileType);
|
||||
}
|
||||
|
||||
bool FileFormat::isMyFileType(const QString fileType)
|
||||
bool OstmFileFormat::isMyFileType(const QString fileType)
|
||||
{
|
||||
if (fileType.startsWith("Ostinato"))
|
||||
return true;
|
@ -16,18 +16,18 @@ GNU General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
#ifndef _FILE_FORMAT_H
|
||||
#define _FILE_FORMAT_H
|
||||
#ifndef _OSTM_FILE_FORMAT_H
|
||||
#define _OSTM_FILE_FORMAT_H
|
||||
|
||||
#include "abstractfileformat.h"
|
||||
#include "nativefileformat.h"
|
||||
#include "streamfileformat.h"
|
||||
|
||||
#include "fileformat.pb.h"
|
||||
|
||||
class FileFormat : public AbstractFileFormat, public NativeFileFormat
|
||||
class OstmFileFormat : public StreamFileFormat, public NativeFileFormat
|
||||
{
|
||||
public:
|
||||
FileFormat();
|
||||
OstmFileFormat();
|
||||
|
||||
virtual bool openStreams(const QString fileName,
|
||||
OstProto::StreamConfigList &streams, QString &error);
|
||||
@ -38,6 +38,6 @@ public:
|
||||
bool isMyFileType(const QString fileType);
|
||||
};
|
||||
|
||||
extern FileFormat fileFormat;
|
||||
extern OstmFileFormat fileFormat;
|
||||
|
||||
#endif
|
@ -35,12 +35,11 @@ PROTOS = \
|
||||
# TODO: Move fileformat related stuff into a different library - why?
|
||||
HEADERS = \
|
||||
ostprotolib.h \
|
||||
abstractfileformat.h \
|
||||
fileformat.h \
|
||||
ipv4addressdelegate.h \
|
||||
ipv6addressdelegate.h \
|
||||
nativefileformat.h \
|
||||
ossnfileformat.h \
|
||||
ostmfileformat.h \
|
||||
pcapfileformat.h \
|
||||
pdmlfileformat.h \
|
||||
pythonfileformat.h \
|
||||
@ -48,6 +47,7 @@ HEADERS = \
|
||||
pdmlprotocols.h \
|
||||
pdmlreader.h \
|
||||
sessionfileformat.h \
|
||||
streamfileformat.h \
|
||||
spinboxdelegate.h
|
||||
|
||||
HEADERS += \
|
||||
@ -83,10 +83,9 @@ HEADERS += \
|
||||
|
||||
SOURCES += \
|
||||
ostprotolib.cpp \
|
||||
abstractfileformat.cpp \
|
||||
fileformat.cpp \
|
||||
nativefileformat.cpp \
|
||||
ossnfileformat.cpp \
|
||||
ostmfileformat.cpp \
|
||||
pcapfileformat.cpp \
|
||||
pdmlfileformat.cpp \
|
||||
pythonfileformat.cpp \
|
||||
@ -94,6 +93,7 @@ SOURCES += \
|
||||
pdmlprotocols.cpp \
|
||||
pdmlreader.cpp \
|
||||
sessionfileformat.cpp \
|
||||
streamfileformat.cpp \
|
||||
spinboxdelegate.cpp
|
||||
|
||||
SOURCES += \
|
||||
|
@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
#ifndef _PCAP_FILE_FORMAT_H
|
||||
#define _PCAP_FILE_FORMAT_H
|
||||
|
||||
#include "abstractfileformat.h"
|
||||
#include "streamfileformat.h"
|
||||
#include "ui_pcapfileimport.h"
|
||||
|
||||
#include <QDataStream>
|
||||
@ -39,7 +39,7 @@ private:
|
||||
};
|
||||
|
||||
class PdmlReader;
|
||||
class PcapFileFormat : public AbstractFileFormat
|
||||
class PcapFileFormat : public StreamFileFormat
|
||||
{
|
||||
friend class PdmlReader;
|
||||
|
||||
|
@ -80,7 +80,7 @@ bool PdmlFileFormat::saveStreams(const OstProto::StreamConfigList streams,
|
||||
{
|
||||
bool isOk = false;
|
||||
QTemporaryFile pcapFile;
|
||||
AbstractFileFormat *fmt = AbstractFileFormat::fileFormatFromType("PCAP");
|
||||
StreamFileFormat *fmt = StreamFileFormat::fileFormatFromType("PCAP");
|
||||
QProcess tshark;
|
||||
|
||||
Q_ASSERT(fmt);
|
||||
|
@ -19,9 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
#ifndef _PDML_FILE_FORMAT_H
|
||||
#define _PDML_FILE_FORMAT_H
|
||||
|
||||
#include "abstractfileformat.h"
|
||||
#include "streamfileformat.h"
|
||||
|
||||
class PdmlFileFormat : public AbstractFileFormat
|
||||
class PdmlFileFormat : public StreamFileFormat
|
||||
{
|
||||
public:
|
||||
PdmlFileFormat();
|
||||
|
@ -20,11 +20,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
#ifndef _PYTHON_FILE_FORMAT_H
|
||||
#define _PYTHON_FILE_FORMAT_H
|
||||
|
||||
#include "abstractfileformat.h"
|
||||
#include "streamfileformat.h"
|
||||
|
||||
#include <QTextStream>
|
||||
|
||||
class PythonFileFormat : public AbstractFileFormat
|
||||
class PythonFileFormat : public StreamFileFormat
|
||||
{
|
||||
public:
|
||||
PythonFileFormat();
|
||||
|
@ -17,35 +17,35 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include "abstractfileformat.h"
|
||||
#include "streamfileformat.h"
|
||||
|
||||
#include "fileformat.h"
|
||||
#include "ostmfileformat.h"
|
||||
#include "pcapfileformat.h"
|
||||
#include "pdmlfileformat.h"
|
||||
#include "pythonfileformat.h"
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
AbstractFileFormat::AbstractFileFormat()
|
||||
StreamFileFormat::StreamFileFormat()
|
||||
{
|
||||
stop_ = false;
|
||||
}
|
||||
|
||||
AbstractFileFormat::~AbstractFileFormat()
|
||||
StreamFileFormat::~StreamFileFormat()
|
||||
{
|
||||
}
|
||||
|
||||
QDialog* AbstractFileFormat::openOptionsDialog()
|
||||
QDialog* StreamFileFormat::openOptionsDialog()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
QDialog* AbstractFileFormat::saveOptionsDialog()
|
||||
QDialog* StreamFileFormat::saveOptionsDialog()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
QStringList AbstractFileFormat::supportedFileTypes(Operation op)
|
||||
QStringList StreamFileFormat::supportedFileTypes(Operation op)
|
||||
{
|
||||
QStringList fileTypes;
|
||||
|
||||
@ -62,7 +62,7 @@ QStringList AbstractFileFormat::supportedFileTypes(Operation op)
|
||||
return fileTypes;
|
||||
}
|
||||
|
||||
void AbstractFileFormat::openStreamsOffline(const QString fileName,
|
||||
void StreamFileFormat::openStreamsOffline(const QString fileName,
|
||||
OstProto::StreamConfigList &streams, QString &error)
|
||||
{
|
||||
fileName_ = fileName;
|
||||
@ -74,7 +74,7 @@ void AbstractFileFormat::openStreamsOffline(const QString fileName,
|
||||
start();
|
||||
}
|
||||
|
||||
void AbstractFileFormat::saveStreamsOffline(
|
||||
void StreamFileFormat::saveStreamsOffline(
|
||||
const OstProto::StreamConfigList streams,
|
||||
const QString fileName, QString &error)
|
||||
{
|
||||
@ -87,12 +87,12 @@ void AbstractFileFormat::saveStreamsOffline(
|
||||
start();
|
||||
}
|
||||
|
||||
bool AbstractFileFormat::result()
|
||||
bool StreamFileFormat::result()
|
||||
{
|
||||
return result_;
|
||||
}
|
||||
|
||||
AbstractFileFormat* AbstractFileFormat::fileFormatFromFile(
|
||||
StreamFileFormat* StreamFileFormat::fileFormatFromFile(
|
||||
const QString fileName)
|
||||
{
|
||||
if (fileFormat.isMyFileFormat(fileName))
|
||||
@ -107,7 +107,7 @@ AbstractFileFormat* AbstractFileFormat::fileFormatFromFile(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AbstractFileFormat* AbstractFileFormat::fileFormatFromType(
|
||||
StreamFileFormat* StreamFileFormat::fileFormatFromType(
|
||||
const QString fileType)
|
||||
{
|
||||
|
||||
@ -126,12 +126,12 @@ AbstractFileFormat* AbstractFileFormat::fileFormatFromType(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void AbstractFileFormat::cancel()
|
||||
void StreamFileFormat::cancel()
|
||||
{
|
||||
stop_ = true;
|
||||
}
|
||||
|
||||
void AbstractFileFormat::run()
|
||||
void StreamFileFormat::run()
|
||||
{
|
||||
if (op_ == kOpenFile)
|
||||
result_ = openStreams(fileName_, *openStreams_, *error_);
|
@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#ifndef _ABSTRACT_FILE_FORMAT_H
|
||||
#define _ABSTRACT_FILE_FORMAT_H
|
||||
#ifndef _STREAM_FILE_FORMAT_H
|
||||
#define _STREAM_FILE_FORMAT_H
|
||||
|
||||
#include "protocol.pb.h"
|
||||
|
||||
@ -27,14 +27,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
class QDialog;
|
||||
|
||||
class AbstractFileFormat : public QThread
|
||||
class StreamFileFormat : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Operation { kOpenFile, kSaveFile };
|
||||
|
||||
AbstractFileFormat();
|
||||
virtual ~AbstractFileFormat();
|
||||
StreamFileFormat();
|
||||
virtual ~StreamFileFormat();
|
||||
|
||||
virtual bool openStreams(const QString fileName,
|
||||
OstProto::StreamConfigList &streams, QString &error) = 0;
|
||||
@ -53,8 +53,8 @@ public:
|
||||
|
||||
static QStringList supportedFileTypes(Operation op);
|
||||
|
||||
static AbstractFileFormat* fileFormatFromFile(const QString fileName);
|
||||
static AbstractFileFormat* fileFormatFromType(const QString fileType);
|
||||
static StreamFileFormat* fileFormatFromFile(const QString fileName);
|
||||
static StreamFileFormat* fileFormatFromType(const QString fileType);
|
||||
|
||||
#if 0
|
||||
bool isMyFileFormat(const QString fileName) = 0;
|
Loading…
Reference in New Issue
Block a user