Ejemplo n.º 1
0
PowerManagementRecordGui::PowerManagementRecordGui(SerialPort* p, QWidget* parent)
                                                    : QDialog(parent)
{
    socket = p;
#else
PowerManagementRecordGui::PowerManagementRecordGui(QTcpSocket* tcpSocket, QWidget* parent)
                                                    : QDialog(parent)
{
    socket = tcpSocket;
#endif
    PowerManagementRecordUi.setupUi(this);
    requestRecordingStatus();
// Ask for the microcontroller SD card free space (process response later)
    getFreeSpace();
    model = new QStandardItemModel(0, 2, this);
    PowerManagementRecordUi.fileTableView->setModel(model);
    PowerManagementRecordUi.fileTableView->setGridStyle(Qt::NoPen);
    PowerManagementRecordUi.fileTableView->setShowGrid(false);
    QHeaderView *verticalHeader = PowerManagementRecordUi.fileTableView->verticalHeader();
    verticalHeader->setResizeMode(QHeaderView::Fixed);
    verticalHeader->setDefaultSectionSize(18);
    row = 0;
// Signal to process a click on a directory item
    connect(PowerManagementRecordUi.fileTableView,
                     SIGNAL(clicked(const QModelIndex)),
                     this,SLOT(onListItemClicked(const QModelIndex)));
// Send a command to refresh the directory
    refreshDirectory();
    writeFileHandle = 0xFF;
}

PowerManagementRecordGui::~PowerManagementRecordGui()
{
}

//-----------------------------------------------------------------------------
/** @brief Delete File.

If the delete checkbox is selected, delete the file (if it exists).
*/

void PowerManagementRecordGui::on_deleteButton_clicked()
{
    QString fileName = PowerManagementRecordUi.recordFileName->text();
    if ((fileName.length() > 0) &&
        (PowerManagementRecordUi.deleteCheckBox->isChecked()))
    {
        socket->write("fX");
        socket->write(fileName.toLocal8Bit().data());
        socket->write("\n\r");
        refreshDirectory();
        getFreeSpace();
    }
}
Ejemplo n.º 2
0
void KfmServIpc::parse_refreshDirectory( char *_data, int _len )
{
	int pos = 0;

	// Parsing string
	const char* _url;
	_url = read_string( _data, pos, _len );
	// Calling function
	emit refreshDirectory( _url );
	free( (void*)_url );
}
Ejemplo n.º 3
0
void PowerManagementRecordGui::on_recordFileButton_clicked()
{
    QString fileName = PowerManagementRecordUi.recordFileName->text();
    if (fileName.length() > 0)
    {
        socket->write("fW");
        socket->write(fileName.toLocal8Bit().data());
        socket->write("\n\r");
        requestRecordingStatus();
        refreshDirectory();
    }
}
Ejemplo n.º 4
0
void PowerManagementRecordGui::on_registerButton_clicked()
{
    socket->write("fM/\n\r");
    refreshDirectory();
}