Commit 1423b756 authored by Jan Möbius's avatar Jan Möbius
Browse files

Finished loadWidget Implementation

parent 2a32aa8f
......@@ -1333,6 +1333,35 @@ QWidget *FilePTSPlugin::loadOptionsWidget( QString /*_currentFilter*/ )
if ( loadOptions_ == nullptr) {
loadOptions_ = new ptsLoadWiget();
QStringList order = OpenFlipperSettings().value( "FilePTS/Load/Order", "position,normal,color,size,index" ).toString().split(",");
loadOptions_->listWidget->clear();
for ( const QString& name : order ) {
if ( name == "position" ) {
loadOptions_->listWidget->addItem("Position");
}
if ( name == "normal" ) {
loadOptions_->listWidget->addItem("Normal");
}
if ( name == "color" ) {
loadOptions_->listWidget->addItem("Color");
}
if ( name == "size" ) {
loadOptions_->listWidget->addItem("PointSize");
}
if ( name == "index" ) {
loadOptions_->listWidget->addItem("Index");
}
}
loadOptions_->type->setCurrentIndex ( OpenFlipperSettings().value( "FilePTS/Load/LoadType", 0 ).toInt() );
loadOptions_->binary->setChecked ( OpenFlipperSettings().value( "FilePTS/Load/BinaryFile", true ).toBool() );
loadOptions_->pointCount->setChecked ( OpenFlipperSettings().value( "FilePTS/Load/PointCount", true ).toBool() );
......@@ -1342,6 +1371,10 @@ QWidget *FilePTSPlugin::loadOptionsWidget( QString /*_currentFilter*/ )
loadOptions_->comboColor->setCurrentIndex(OpenFlipperSettings().value( "FilePTS/Load/ColorRange", 0 ).toInt() );
loadOptions_->listWidget->findItems("Color",Qt::MatchExactly)[0]->setSelected(OpenFlipperSettings().value( "FilePTS/Load/Colors", true ).toBool()) ;
loadOptions_->listWidget->findItems("Index",Qt::MatchExactly)[0]->setSelected(OpenFlipperSettings().value( "FilePTS/Load/Indices", true ).toBool() );
connect(loadOptions_->defaultButton,SIGNAL( clicked() ) , this, SLOT(slotLoadMakeDefaultButtonClicked() ) );
connect(loadOptions_->defaultButton,SIGNAL( clicked() ) , this, SLOT(slotLoadMakeDefaultButtonClicked() ) );
}
return loadOptions_;
......@@ -1417,16 +1450,6 @@ QWidget *FilePTSPlugin::saveOptionsWidget( QString _currentFilter )
//----------------------------------------------------------------
void FilePTSPlugin::slotUpdateLoadColorRange()
{
//loadColorRange_->setEnabled( loadColors_->isChecked() && !loadBinaryFile_->isChecked() );
}
//----------------------------------------------------------------
void FilePTSPlugin::slotUpdateSaveColorRange()
{
saveColorRange_->setEnabled( saveColors_->isChecked() && !saveBinaryFile_->isChecked() );
......@@ -1450,8 +1473,34 @@ void FilePTSPlugin::slotLoadMakeDefaultButtonClicked()
OpenFlipperSettings().setValue( "FilePTS/Load/ColorRange", loadOptions_->comboColor->currentIndex() );
OpenFlipperSettings().setValue( "FilePTS/Load/Indices", loadOptions_->listWidget->findItems("Index",Qt::MatchExactly)[0]->isSelected() );
QString order = "";
for ( auto i = 0 ; i < loadOptions_->listWidget->count() ; ++i ) {
if (loadOptions_->listWidget->item(i)->text() == "Position" ) {
order +="position,";
}
if (loadOptions_->listWidget->item(i)->text() == "Normal" ) {
order +="normal,";
}
if (loadOptions_->listWidget->item(i)->text() == "Color" ) {
order +="color,";
}
if (loadOptions_->listWidget->item(i)->text() == "PointSize" ) {
order +="size,";
}
if (loadOptions_->listWidget->item(i)->text() == "Index" ) {
order +="index,";
}
}
// remove last ","
order.chop(1);
// OpenFlipperSettings().setValue( "Core/File/UseLoadDefaults", true );
OpenFlipperSettings().setValue( "FilePTS/Load/Order", order );
}
......
......@@ -214,7 +214,6 @@ private:
private slots:
// slots called when the Load/Save colors checkbox or binaryfile checkbox was clicked
void slotUpdateLoadColorRange();
void slotUpdateSaveColorRange();
// slots called when user wants to save the given Load/Save Options as default
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>307</width>
<height>447</height>
<width>679</width>
<height>465</height>
</rect>
</property>
<property name="windowTitle">
......@@ -128,6 +128,13 @@
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Drag elements to define their order, then select the ones that should be read from the file.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment