mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
Fixes Problem under Linux, tested Ok under Ubuntu
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@473 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
402b4e8e24
commit
eb6961c173
@ -8,7 +8,7 @@ HEADERS += uploadergadget.h \
|
||||
uploadergadgetoptionspage.h \
|
||||
uploadergadgetwidget.h \
|
||||
uploaderplugin.h
|
||||
SOURCES += uploaderGadget.cpp \
|
||||
SOURCES += uploadergadget.cpp \
|
||||
uploadergadgetconfiguration.cpp \
|
||||
uploadergadgetfactory.cpp \
|
||||
uploadergadgetoptionspage.cpp \
|
||||
|
@ -41,7 +41,40 @@ UploaderGadgetOptionsPage::UploaderGadgetOptionsPage(UploaderGadgetConfiguration
|
||||
IOptionsPage(parent),
|
||||
m_config(config)
|
||||
{
|
||||
#ifdef _TTY_POSIX_
|
||||
#ifdef Q_OS_WIN
|
||||
|
||||
BaudRateTypeString
|
||||
<<"BAUD110"
|
||||
<<"BAUD300"
|
||||
<<"BAUD600"
|
||||
<<"BAUD1200"
|
||||
<<"BAUD2400"
|
||||
<<"BAUD4800"
|
||||
<<"BAUD9600"
|
||||
<<"BAUD14400"
|
||||
<<"BAUD19200"
|
||||
<<"BAUD38400"
|
||||
<<"BAUD56000"
|
||||
<<"BAUD57600"
|
||||
<<"BAUD115200"
|
||||
<<"BAUD128000"
|
||||
<<"BAUD256000";
|
||||
DataBitsTypeString
|
||||
<<"DATA_5"
|
||||
<<"DATA_6"
|
||||
<<"DATA_7"
|
||||
<<"DATA_8";
|
||||
ParityTypeString
|
||||
<<"PAR_NONE"
|
||||
<<"PAR_ODD"
|
||||
<<"PAR_EVEN"
|
||||
<<"PAR_MARK" //WINDOWS ONLY
|
||||
<<"PAR_SPACE";
|
||||
StopBitsTypeString
|
||||
<<"STOP_1"
|
||||
<<"STOP_1_5" //WINDOWS ONLY
|
||||
<<"STOP_2";
|
||||
#else
|
||||
BaudRateTypeString
|
||||
|
||||
<<"BAUD50" //POSIX ONLY
|
||||
@ -75,38 +108,6 @@ UploaderGadgetOptionsPage::UploaderGadgetOptionsPage(UploaderGadgetConfiguration
|
||||
StopBitsTypeString
|
||||
<<"STOP_1"
|
||||
<<"STOP_2";
|
||||
#else
|
||||
BaudRateTypeString
|
||||
<<"BAUD110"
|
||||
<<"BAUD300"
|
||||
<<"BAUD600"
|
||||
<<"BAUD1200"
|
||||
<<"BAUD2400"
|
||||
<<"BAUD4800"
|
||||
<<"BAUD9600"
|
||||
<<"BAUD14400"
|
||||
<<"BAUD19200"
|
||||
<<"BAUD38400"
|
||||
<<"BAUD56000"
|
||||
<<"BAUD57600"
|
||||
<<"BAUD115200"
|
||||
<<"BAUD128000"
|
||||
<<"BAUD256000";
|
||||
DataBitsTypeString
|
||||
<<"DATA_5"
|
||||
<<"DATA_6"
|
||||
<<"DATA_7"
|
||||
<<"DATA_8";
|
||||
ParityTypeString
|
||||
<<"PAR_NONE"
|
||||
<<"PAR_ODD"
|
||||
<<"PAR_EVEN"
|
||||
<<"PAR_MARK" //WINDOWS ONLY
|
||||
<<"PAR_SPACE";
|
||||
StopBitsTypeString
|
||||
<<"STOP_1"
|
||||
<<"STOP_1_5" //WINDOWS ONLY
|
||||
<<"STOP_2";
|
||||
#endif
|
||||
|
||||
BaudRateTypeStringALL
|
||||
@ -232,6 +233,7 @@ QWidget *UploaderGadgetOptionsPage::createPage(QWidget *parent)
|
||||
label = new QLabel("TimeOut(ms):");
|
||||
m_timeoutSpin = new QSpinBox();
|
||||
m_timeoutSpin->setMaximum(100000);
|
||||
m_timeoutSpin->setMinimumSize(200,22);
|
||||
timeoutLayout->addWidget(label);
|
||||
timeoutLayout->addWidget(m_timeoutSpin);
|
||||
|
||||
@ -256,9 +258,16 @@ QWidget *UploaderGadgetOptionsPage::createPage(QWidget *parent)
|
||||
|
||||
QList<QextPortInfo> ports =QextSerialEnumerator ::getPorts();
|
||||
qSort(ports.begin(), ports.end());
|
||||
#ifdef Q_OS_WIN
|
||||
for (int i = 0; i < ports.size(); i++) {
|
||||
m_portCB->addItem((QString)ports.at(i).portName.toLocal8Bit().constData());
|
||||
}
|
||||
#else
|
||||
for (int i = 0; i < ports.size(); i++) {
|
||||
m_portCB->addItem((QString)ports.at(i).physName.toLocal8Bit().constData());
|
||||
}
|
||||
#endif
|
||||
|
||||
if(m_portCB->findText(m_config->Port())!=-1){
|
||||
m_portCB->setCurrentIndex(m_portCB->findText(m_config->Port()));
|
||||
}
|
||||
|
@ -78,18 +78,17 @@ UploaderGadgetWidget::UploaderGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
|
||||
void UploaderGadgetWidget::updatePerc()
|
||||
{
|
||||
if(Ymodem->isRunning())
|
||||
if(!Ymodem->isRunning())
|
||||
{
|
||||
progressBar->setValue(Ymodem->PercentSend());
|
||||
timer->stop();
|
||||
}
|
||||
else
|
||||
timer->stop();
|
||||
progressBar->setValue(percent);
|
||||
}
|
||||
|
||||
void UploaderGadgetWidget::send()
|
||||
{
|
||||
Ymodem->SendFileT(openFileNameLE->text());
|
||||
timer->start();
|
||||
timer->start(500);
|
||||
}
|
||||
|
||||
UploaderGadgetWidget::~UploaderGadgetWidget()
|
||||
@ -106,8 +105,14 @@ void UploaderGadgetWidget::setPort(QextSerialPort* port)
|
||||
,this,SLOT(error(QString,int)));
|
||||
connect(Ymodem,SIGNAL(Information(QString,int)),
|
||||
this,SLOT(info(QString,int)));
|
||||
connect(Ymodem,SIGNAL(Percent(int)),
|
||||
this,SLOT(updatePercSlot(int)));
|
||||
}
|
||||
|
||||
void UploaderGadgetWidget::updatePercSlot(int i)
|
||||
{
|
||||
percent=i;
|
||||
}
|
||||
|
||||
void UploaderGadgetWidget::setOpenFileName()
|
||||
{
|
||||
|
@ -68,6 +68,7 @@ private:
|
||||
QymodemSend * Ymodem;
|
||||
QProgressBar *progressBar;
|
||||
QTimer *timer;
|
||||
int percent;
|
||||
|
||||
private slots:
|
||||
void setOpenFileName();
|
||||
@ -75,6 +76,7 @@ private slots:
|
||||
void error(QString errorString,int errorNumber);
|
||||
void info(QString infoString,int infoNumber);
|
||||
void updatePerc();
|
||||
void updatePercSlot(int);
|
||||
};
|
||||
|
||||
#endif // UPLOADERGADGETWIDGET_H
|
||||
|
Loading…
Reference in New Issue
Block a user