Commit 91b49f3a authored by Dirk Wilden's avatar Dirk Wilden

defaults for load/save options

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7709 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 1660a503
......@@ -56,6 +56,16 @@ FileOptionsDialog::FileOptionsDialog(std::vector<fileTypes>& _supportedTypes, QS
}
}
//force TriangleMesh as initial value if available
for (int i=0; i < boxes_.count(); i++){
for (int t=0; t < (boxes_[i])->count(); t++)
if ( (boxes_[i])->itemText(t).contains("TriangleMesh") ){
(boxes_[i])->setCurrentIndex(t);
break;
}
}
//load defaults from ini file
QString filename = OpenFlipper::Options::configDirStr() + OpenFlipper::Options::dirSeparator() + "OpenFlipper.ini";
......@@ -69,7 +79,7 @@ FileOptionsDialog::FileOptionsDialog(std::vector<fileTypes>& _supportedTypes, QS
for (int i=0; i < boxes_.count(); i++){
QString pluginName;
if ( ini.get_entry(pluginName, "Options" , "Extension_" + _extensions[i] ) ){
if ( ini.get_entry(pluginName, "LoadSave" , "Extension_" + _extensions[i] ) ){
for (int t=0; t < (boxes_[i])->count(); t++)
if ( (boxes_[i])->itemText(t) == pluginName ){
......@@ -176,7 +186,9 @@ void FileOptionsDialog::slotMakeDefault(){
}
for (int i=0; i < boxes_.count(); i++)
ini.add_entry("Options","Extension_" + (boxes_[i])->accessibleName(), boxes_[i]->currentText() );
ini.add_entry("LoadSave","Extension_" + (boxes_[i])->accessibleName(), boxes_[i]->currentText() );
ini.add_entry("LoadSave","MakeDefault", true );
// close ini file
ini.disconnect();
......
......@@ -72,8 +72,8 @@ LoadWidget::LoadWidget(std::vector<fileTypes>& _supportedTypes , QWidget *parent
//supported Types
optionsBox_ = new QCheckBox(tr("use defaults"), this);
optionsBox_->setChecked(true);
optionsBox_->setChecked( defaultsSaved() );
// add the options box to the bottom
gridLayout->addWidget( optionsBox_, gridLayout->rowCount() , 1 );
......@@ -404,6 +404,27 @@ void LoadWidget::slotSetPluginForExtension(QString _extension, int _pluginId ){
}
bool LoadWidget::defaultsSaved(){
QString filename = OpenFlipper::Options::configDirStr() + OpenFlipper::Options::dirSeparator() + "OpenFlipper.ini";
INIFile ini;
if ( ! ini.connect(filename,false) ) {
std::cerr << (tr("Failed to connect to ini file %1").arg(filename)).toStdString() << std::endl;
return false;
}
bool makeDefault = false;
ini.get_entry(makeDefault, "LoadSave" , "MakeDefault" );
// close ini file
ini.disconnect();
return makeDefault;
}
void LoadWidget::getPluginForExtensionINI(QStringList _extensions){
QString filename = OpenFlipper::Options::configDirStr() + OpenFlipper::Options::dirSeparator() + "OpenFlipper.ini";
......@@ -418,7 +439,7 @@ void LoadWidget::getPluginForExtensionINI(QStringList _extensions){
for (int i=0; i < _extensions.count(); i++){
QString pluginName;
if ( ini.get_entry(pluginName, "Options" , "Extension_" + _extensions[i] ) ){
if ( ini.get_entry(pluginName, "LoadSave" , "Extension_" + _extensions[i] ) ){
for (uint t=0; t < supportedTypes_.size(); t++)
if ( supportedTypes_[t].name == pluginName ){
......@@ -427,7 +448,7 @@ void LoadWidget::getPluginForExtensionINI(QStringList _extensions){
}
}
}
// close ini file
ini.disconnect();
}
......
......@@ -73,6 +73,7 @@ class LoadWidget : public QFileDialog
std::vector<fileTypes>& supportedTypes_;
void getPluginForExtensionINI(QStringList _extensions);
bool defaultsSaved();
public:
int showLoad();
......
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