1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +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:
edouard 2011-01-22 08:37:25 +00:00 committed by edouard
parent 9da3ccc708
commit 7527811a25
2 changed files with 12 additions and 40 deletions

View File

@ -302,12 +302,16 @@ void LoggingThread::transactionCompleted(UAVObject* obj, bool success)
LoggingPlugin::LoggingPlugin() : state(IDLE)
{
// Do nothing
logConnection = new LoggingConnection();
}
LoggingPlugin::~LoggingPlugin()
{
if (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()));
// 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);
addAutoReleasedObject(mf);
// 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;
}
@ -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
@ -470,7 +440,7 @@ void LoggingPlugin::replayStopped()
if(uavTalk)
delete(uavTalk);
logFile.close();
getLogfile()->close();
uavTalk = 0;
state = IDLE;
@ -484,7 +454,7 @@ void LoggingPlugin::replayStopped()
void LoggingPlugin::extensionsInitialized()
{
addAutoReleasedObject(new LoggingConnection);
addAutoReleasedObject(logConnection);
}
void LoggingPlugin::shutdown()

View File

@ -62,6 +62,7 @@ public:
virtual QString shortName();
bool deviceOpened() {return m_deviceOpened;}
LogFile* getLogfile() { return &logFile;}
private:
@ -117,7 +118,9 @@ public:
bool initialize(const QStringList & arguments, QString * errorString);
void shutdown();
LogFile * getLogfile() { return &logFile; };
LoggingConnection* getLogConnection() { return logConnection; };
LogFile* getLogfile() { return logConnection->getLogfile();}
signals:
void stopLoggingSignal(void);
@ -131,11 +134,10 @@ protected:
// These are used for replay, logging in its own thread
UAVTalk * uavTalk;
LogFile logFile;
LoggingConnection* logConnection;
private slots:
void toggleLogging();
void toggleReplay();
void startLogging(QString file);
void stopLogging();
void loggingStopped();