Skip to content

Commit 1f2553a

Browse files
committed
[uconfig_gui] Fixed importer wizard
1 parent 1a5119f commit 1f2553a

3 files changed

Lines changed: 20 additions & 8 deletions

File tree

src/uconfig_gui/importer/datasheetprocesspage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void DatasheetProcessPage::initializePage()
6868
_pageCount = _thread->pageEnd() - _thread->pageBegin();
6969
}
7070
_progressBar->setMinimum(_pageStart + 1);
71-
_progressBar->setMaximum(_pageStart + _pageCount +1);
71+
_progressBar->setMaximum(_pageStart + _pageCount + 1);
7272

7373
_logger->clear();
7474
_datasheet->clean();

src/uconfig_gui/importer/datasheetthread.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ DataSheetThread::DataSheetThread(Datasheet *datasheet)
1212

1313
DataSheetThread::~DataSheetThread()
1414
{
15-
quit();
16-
terminate();
15+
if (isRunning())
16+
{
17+
quit();
18+
terminate();
19+
}
1720
delete _datasheet;
1821
}
1922

src/uconfig_gui/importer/pdffilepage.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ PDFFilePage::PDFFilePage(DataSheetThread *datasheetThread) :
4343

4444
_forceCheckBox = new QCheckBox(tr("Force détection\n(try to build component in each page,\nvery expensive)"));
4545
_allRadio->setChecked(true);
46+
connect(_forceCheckBox, SIGNAL(toggled(bool)), this, SLOT(check()));
4647
rangeGroupLayout->addWidget(_forceCheckBox);
4748
rangeGroupLayout->addSpacerItem(new QSpacerItem(10, 30, QSizePolicy::Expanding, QSizePolicy::Expanding));
4849

@@ -80,7 +81,6 @@ void PDFFilePage::check()
8081
_forceCheckBox->setEnabled(!_allRadio->isChecked());
8182
_rangeEdit->setEnabled(!_allRadio->isChecked());
8283
_complete = _rangeEdit->hasAcceptableInput() || _allRadio->isChecked();
83-
emit completeChanged();
8484

8585
if (_complete)
8686
{
@@ -89,15 +89,24 @@ void PDFFilePage::check()
8989
_datasheetThread->setRange();
9090
else
9191
{
92-
int start=-1, stop=-1;
92+
int start = -1, stop = -1;
9393
QRegularExpression reg("^([0-9]+)(\\-[0-9]+)?$");
9494
QRegularExpressionMatch match = reg.match(_rangeEdit->text());
95-
start = match.captured(1).toInt()-1;
96-
if (match.capturedTexts().count()>2)
97-
stop = -match.captured(2).toInt()-1;
95+
start = match.captured(1).toInt() - 1;
96+
if (start >= _datasheetThread->datasheet()->pageCount() || start < 0)
97+
_complete = false;
98+
if (match.capturedTexts().count() > 2)
99+
{
100+
stop = -match.captured(2).toInt() - 1;
101+
if (stop >= _datasheetThread->datasheet()->pageCount() || stop < 0)
102+
_complete = false;
103+
if (start > stop)
104+
_complete = false;
105+
}
98106
_datasheetThread->setRange(start, stop);
99107
}
100108
}
109+
emit completeChanged();
101110
}
102111

103112
bool PDFFilePage::isComplete() const

0 commit comments

Comments
 (0)