mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
OP-250 Update menu entry for logging so that it reads "Stop logging" when logging is going on.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@3038 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
14ca3f31ae
commit
c355dfff44
@ -40,9 +40,6 @@
|
|||||||
#include <QWriteLocker>
|
#include <QWriteLocker>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
|
||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
|
||||||
#include <coreplugin/icore.h>
|
|
||||||
#include <QKeySequence>
|
#include <QKeySequence>
|
||||||
#include "uavobjectmanager.h"
|
#include "uavobjectmanager.h"
|
||||||
|
|
||||||
@ -71,6 +68,8 @@ QStringList LoggingConnection::availableDevices()
|
|||||||
|
|
||||||
QIODevice* LoggingConnection::openDevice(const QString &deviceName)
|
QIODevice* LoggingConnection::openDevice(const QString &deviceName)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(deviceName)
|
||||||
|
|
||||||
if (logFile.isOpen()){
|
if (logFile.isOpen()){
|
||||||
logFile.close();
|
logFile.close();
|
||||||
}
|
}
|
||||||
@ -329,7 +328,7 @@ bool LoggingPlugin::initialize(const QStringList& args, QString *errMsg)
|
|||||||
Core::ActionContainer* ac = am->actionContainer(Core::Constants::M_TOOLS);
|
Core::ActionContainer* ac = am->actionContainer(Core::Constants::M_TOOLS);
|
||||||
|
|
||||||
// Command to start logging
|
// Command to start logging
|
||||||
Core::Command* cmd = am->registerAction(new QAction(this),
|
cmd = am->registerAction(new QAction(this),
|
||||||
"LoggingPlugin.Logging",
|
"LoggingPlugin.Logging",
|
||||||
QList<int>() <<
|
QList<int>() <<
|
||||||
Core::Constants::C_GLOBAL_ID);
|
Core::Constants::C_GLOBAL_ID);
|
||||||
@ -360,22 +359,21 @@ void LoggingPlugin::toggleLogging()
|
|||||||
{
|
{
|
||||||
if(state == IDLE)
|
if(state == IDLE)
|
||||||
{
|
{
|
||||||
/*QFileDialog * fd = new QFileDialog();
|
|
||||||
fd->setAcceptMode(QFileDialog::AcceptSave);
|
|
||||||
fd->setNameFilter("OpenPilot Log (*.opl)");
|
|
||||||
connect(fd, SIGNAL(fileSelected(QString)), this, SLOT(startLogging(QString)));
|
|
||||||
fd->exec();*/
|
|
||||||
|
|
||||||
QString fileName = QFileDialog::getSaveFileName(NULL, tr("Start Log"),
|
QString fileName = QFileDialog::getSaveFileName(NULL, tr("Start Log"),
|
||||||
tr("OP-%0.opl").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm-ss")),
|
tr("OP-%0.opl").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm-ss")),
|
||||||
tr("OpenPilot Log (*.opl)"));
|
tr("OpenPilot Log (*.opl)"));
|
||||||
if(!fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
startLogging(fileName);
|
return;
|
||||||
|
|
||||||
|
startLogging(fileName);
|
||||||
|
cmd->action()->setText(tr("Stop logging"));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(state == LOGGING)
|
else if(state == LOGGING)
|
||||||
{
|
{
|
||||||
stopLogging();
|
stopLogging();
|
||||||
|
cmd->action()->setText(tr("Start logging..."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,9 @@
|
|||||||
#ifndef LOGGINGPLUGIN_H_
|
#ifndef LOGGINGPLUGIN_H_
|
||||||
#define LOGGINGPLUGIN_H_
|
#define LOGGINGPLUGIN_H_
|
||||||
|
|
||||||
|
#include <coreplugin/icore.h>
|
||||||
|
#include <coreplugin/coreconstants.h>
|
||||||
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/iconnection.h>
|
#include <coreplugin/iconnection.h>
|
||||||
#include <extensionsystem/iplugin.h>
|
#include <extensionsystem/iplugin.h>
|
||||||
#include "uavobjectmanager.h"
|
#include "uavobjectmanager.h"
|
||||||
@ -120,6 +123,7 @@ public:
|
|||||||
|
|
||||||
LoggingConnection* getLogConnection() { return logConnection; };
|
LoggingConnection* getLogConnection() { return logConnection; };
|
||||||
LogFile* getLogfile() { return logConnection->getLogfile();}
|
LogFile* getLogfile() { return logConnection->getLogfile();}
|
||||||
|
void setLogMenuTitle(QString str);
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -134,7 +138,7 @@ 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;
|
||||||
LoggingConnection* logConnection;
|
LoggingConnection* logConnection;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void toggleLogging();
|
void toggleLogging();
|
||||||
@ -145,6 +149,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
LoggingGadgetFactory *mf;
|
LoggingGadgetFactory *mf;
|
||||||
|
Core::Command* cmd;
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif /* LoggingPLUGIN_H_ */
|
#endif /* LoggingPLUGIN_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user