mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-02 10:24:11 +01:00
OP-263 Re-enabled the logging widget controls. Not working perfectly, but not worse than before either... Will work on this in a separate ticket. This commit should close this issue.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2518 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
9da3ccc708
commit
7527811a25
@ -302,12 +302,16 @@ void LoggingThread::transactionCompleted(UAVObject* obj, bool success)
|
|||||||
LoggingPlugin::LoggingPlugin() : state(IDLE)
|
LoggingPlugin::LoggingPlugin() : state(IDLE)
|
||||||
{
|
{
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
logConnection = new LoggingConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
LoggingPlugin::~LoggingPlugin()
|
LoggingPlugin::~LoggingPlugin()
|
||||||
{
|
{
|
||||||
if (loggingThread)
|
if (loggingThread)
|
||||||
delete loggingThread;
|
delete loggingThread;
|
||||||
|
|
||||||
|
// Don't delete it, the plugin manager will do it:
|
||||||
|
//delete logConnection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -339,26 +343,12 @@ bool LoggingPlugin::initialize(const QStringList& args, QString *errMsg)
|
|||||||
|
|
||||||
connect(cmd->action(), SIGNAL(triggered(bool)), this, SLOT(toggleLogging()));
|
connect(cmd->action(), SIGNAL(triggered(bool)), this, SLOT(toggleLogging()));
|
||||||
|
|
||||||
// Command to replay logging
|
|
||||||
/*
|
|
||||||
Core::Command* cmd2 = am->registerAction(new QAction(this),
|
|
||||||
"LoggingPlugin.Playback",
|
|
||||||
QList<int>() <<
|
|
||||||
Core::Constants::C_GLOBAL_ID);
|
|
||||||
cmd2->setDefaultKeySequence(QKeySequence("Ctrl+R"));
|
|
||||||
cmd2->action()->setText("Replay...");
|
|
||||||
|
|
||||||
ac->appendGroup("Replay");
|
|
||||||
ac->addAction(cmd2, "Replay");
|
|
||||||
|
|
||||||
connect(cmd2->action(), SIGNAL(triggered(bool)), this, SLOT(toggleReplay()));
|
|
||||||
*/
|
|
||||||
|
|
||||||
mf = new LoggingGadgetFactory(this);
|
mf = new LoggingGadgetFactory(this);
|
||||||
addAutoReleasedObject(mf);
|
addAutoReleasedObject(mf);
|
||||||
|
|
||||||
// Map signal from end of replay to replay stopped
|
// Map signal from end of replay to replay stopped
|
||||||
connect(&logFile,SIGNAL(replayFinished()), this, SLOT(replayStopped()));
|
connect(getLogfile(),SIGNAL(replayFinished()), this, SLOT(replayStopped()));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -390,26 +380,6 @@ void LoggingPlugin::toggleLogging()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The action that is triggered by the menu item which opens the
|
|
||||||
* file and begins replay if successful
|
|
||||||
*/
|
|
||||||
void LoggingPlugin::toggleReplay()
|
|
||||||
{
|
|
||||||
if(state == IDLE)
|
|
||||||
{
|
|
||||||
QFileDialog * fd = new QFileDialog();
|
|
||||||
fd->setAcceptMode(QFileDialog::AcceptOpen);
|
|
||||||
fd->setNameFilter("OpenPilot Log (*.opl)");
|
|
||||||
connect(fd, SIGNAL(fileSelected(QString)), this, SLOT(startReplay(QString)));
|
|
||||||
fd->exec();
|
|
||||||
}
|
|
||||||
else if(state == REPLAY)
|
|
||||||
{
|
|
||||||
logFile.stopReplay();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the logging thread to a certain file
|
* Starts the logging thread to a certain file
|
||||||
@ -470,7 +440,7 @@ void LoggingPlugin::replayStopped()
|
|||||||
if(uavTalk)
|
if(uavTalk)
|
||||||
delete(uavTalk);
|
delete(uavTalk);
|
||||||
|
|
||||||
logFile.close();
|
getLogfile()->close();
|
||||||
|
|
||||||
uavTalk = 0;
|
uavTalk = 0;
|
||||||
state = IDLE;
|
state = IDLE;
|
||||||
@ -484,7 +454,7 @@ void LoggingPlugin::replayStopped()
|
|||||||
|
|
||||||
void LoggingPlugin::extensionsInitialized()
|
void LoggingPlugin::extensionsInitialized()
|
||||||
{
|
{
|
||||||
addAutoReleasedObject(new LoggingConnection);
|
addAutoReleasedObject(logConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoggingPlugin::shutdown()
|
void LoggingPlugin::shutdown()
|
||||||
|
@ -62,6 +62,7 @@ public:
|
|||||||
virtual QString shortName();
|
virtual QString shortName();
|
||||||
|
|
||||||
bool deviceOpened() {return m_deviceOpened;}
|
bool deviceOpened() {return m_deviceOpened;}
|
||||||
|
LogFile* getLogfile() { return &logFile;}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -117,7 +118,9 @@ public:
|
|||||||
bool initialize(const QStringList & arguments, QString * errorString);
|
bool initialize(const QStringList & arguments, QString * errorString);
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|
||||||
LogFile * getLogfile() { return &logFile; };
|
LoggingConnection* getLogConnection() { return logConnection; };
|
||||||
|
LogFile* getLogfile() { return logConnection->getLogfile();}
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void stopLoggingSignal(void);
|
void stopLoggingSignal(void);
|
||||||
@ -131,11 +134,10 @@ protected:
|
|||||||
|
|
||||||
// These are used for replay, logging in its own thread
|
// These are used for replay, logging in its own thread
|
||||||
UAVTalk * uavTalk;
|
UAVTalk * uavTalk;
|
||||||
LogFile logFile;
|
LoggingConnection* logConnection;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void toggleLogging();
|
void toggleLogging();
|
||||||
void toggleReplay();
|
|
||||||
void startLogging(QString file);
|
void startLogging(QString file);
|
||||||
void stopLogging();
|
void stopLogging();
|
||||||
void loggingStopped();
|
void loggingStopped();
|
||||||
|
Loading…
Reference in New Issue
Block a user