mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-23 03:26:56 -04:00
Expand GUI for sequencing and input from file
This commit is contained in:
parent
467433f0d0
commit
0bce27959f
11 changed files with 1375 additions and 642 deletions
79
frontend_qt4/datawindow.cpp
Normal file
79
frontend_qt4/datawindow.cpp
Normal file
|
@ -0,0 +1,79 @@
|
|||
#include <QDebug>
|
||||
#include <QFileDialog>
|
||||
#include <QUiLoader>
|
||||
#include <QStringList>
|
||||
|
||||
#include "datawindow.h"
|
||||
#include <stdio.h>
|
||||
|
||||
DataWindow::DataWindow()
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
connect(btnCancel, SIGNAL( clicked( bool )), SLOT(quit_now()));
|
||||
connect(btnReset, SIGNAL( clicked( bool )), SLOT(clear_data()));
|
||||
connect(btnOK, SIGNAL( clicked( bool )), SLOT(okay()));
|
||||
}
|
||||
|
||||
DataWindow::DataWindow(QString input)
|
||||
{
|
||||
setupUi(this);
|
||||
txtDataInput->setPlainText(input);
|
||||
txtDataInput->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
|
||||
|
||||
connect(btnCancel, SIGNAL( clicked( bool )), SLOT(quit_now()));
|
||||
connect(btnReset, SIGNAL( clicked( bool )), SLOT(clear_data()));
|
||||
connect(btnOK, SIGNAL( clicked( bool )), SLOT(okay()));
|
||||
connect(btnFromFile, SIGNAL( clicked( bool )), SLOT(from_file()));
|
||||
}
|
||||
|
||||
DataWindow::~DataWindow()
|
||||
{
|
||||
}
|
||||
|
||||
void DataWindow::quit_now()
|
||||
{
|
||||
Valid = 0;
|
||||
close();
|
||||
}
|
||||
|
||||
void DataWindow::clear_data()
|
||||
{
|
||||
txtDataInput->clear();
|
||||
}
|
||||
|
||||
void DataWindow::okay()
|
||||
{
|
||||
Valid = 1;
|
||||
DataOutput = txtDataInput->toPlainText();
|
||||
close();
|
||||
}
|
||||
|
||||
void DataWindow::from_file()
|
||||
{
|
||||
QString fileName;
|
||||
QFileDialog fdialog;
|
||||
QFile file;
|
||||
char *streamdata;
|
||||
int streamlen;
|
||||
QString utfstream;
|
||||
|
||||
fdialog.setFileMode(QFileDialog::ExistingFile);
|
||||
|
||||
if(fdialog.exec()) {
|
||||
fileName = fdialog.selectedFiles().at(0);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
file.setFileName(fileName);
|
||||
if(!file.open(QIODevice::ReadOnly)) {
|
||||
return;
|
||||
}
|
||||
|
||||
QDataStream input(&file);
|
||||
streamlen = input.readRawData(streamdata, 7095);
|
||||
utfstream = streamdata; /* FIXME: Does not take account of encoding scheme of input data */
|
||||
txtDataInput->setPlainText(utfstream);
|
||||
file.close();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue